Return-Path: X-Original-To: apmail-hadoop-common-commits-archive@www.apache.org Delivered-To: apmail-hadoop-common-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DD34218BDA for ; Mon, 22 Feb 2016 21:46:56 +0000 (UTC) Received: (qmail 60209 invoked by uid 500); 22 Feb 2016 21:46:53 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 60048 invoked by uid 500); 22 Feb 2016 21:46:53 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 59914 invoked by uid 99); 22 Feb 2016 21:46:53 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Feb 2016 21:46:53 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 52F2BE03E1; Mon, 22 Feb 2016 21:46:53 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: cnauroth@apache.org To: common-commits@hadoop.apache.org Date: Mon, 22 Feb 2016 21:46:54 -0000 Message-Id: <2b3e14d688d04ebea334cab35b393efa@git.apache.org> In-Reply-To: <0062840ec5914603af3c8288c94cbeb5@git.apache.org> References: <0062840ec5914603af3c8288c94cbeb5@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] hadoop git commit: HADOOP-11613. Remove commons-httpclient dependency from hadoop-azure. Contributed by Masatake Iwasaki. HADOOP-11613. Remove commons-httpclient dependency from hadoop-azure. Contributed by Masatake Iwasaki. (cherry picked from commit d4f5fc23b208635e8f9a14c375d4101141aefa4a) (cherry picked from commit 3f14eed58055d30b7c2dcb9240355920ff48af7e) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/746d6698 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/746d6698 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/746d6698 Branch: refs/heads/branch-2.8 Commit: 746d66984764f90c1885b08cfd833b66252660cb Parents: 08666fb Author: cnauroth Authored: Mon Feb 22 13:39:38 2016 -0800 Committer: cnauroth Committed: Mon Feb 22 13:39:57 2016 -0800 ---------------------------------------------------------------------- hadoop-common-project/hadoop-common/CHANGES.txt | 3 ++ .../hadoop/fs/azure/MockStorageInterface.java | 33 +++++++------------- 2 files changed, 15 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/746d6698/hadoop-common-project/hadoop-common/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index a09b2be..eede69f 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -414,6 +414,9 @@ Release 2.8.0 - UNRELEASED HADOOP-12828. Print user when services are started. (Wei-Chiu Chuang via Yongjun Zhang) + HADOOP-11613. Remove commons-httpclient dependency from hadoop-azure. + (Masatake Iwasaki via cnauroth) + OPTIMIZATIONS HADOOP-11785. Reduce the number of listStatus operation in distcp http://git-wip-us.apache.org/repos/asf/hadoop/blob/746d6698/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/MockStorageInterface.java ---------------------------------------------------------------------- diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/MockStorageInterface.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/MockStorageInterface.java index 2bb2a9a..4fda017 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/MockStorageInterface.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/MockStorageInterface.java @@ -33,9 +33,10 @@ import java.util.HashMap; import java.util.HashSet; import java.util.TimeZone; import java.util.List; -import org.apache.commons.httpclient.URIException; -import org.apache.commons.httpclient.util.URIUtil; +import org.apache.commons.codec.DecoderException; +import org.apache.commons.codec.net.URLCodec; import org.apache.commons.lang.NotImplementedException; +import org.apache.http.client.utils.URIBuilder; import com.microsoft.azure.storage.AccessCondition; import com.microsoft.azure.storage.CloudStorageAccount; @@ -68,6 +69,7 @@ public class MockStorageInterface extends StorageInterface { private final ArrayList preExistingContainers = new ArrayList(); private String baseUriString; + private static final URLCodec codec = new URLCodec(); public InMemoryBlockBlobStore getBackingStore() { return backingStore; @@ -126,22 +128,17 @@ public class MockStorageInterface extends StorageInterface { */ private static String convertUriToDecodedString(URI uri) { try { - String result = URIUtil.decode(uri.toString()); - return result; - } catch (URIException e) { + return codec.decode(uri.toString()); + } catch (DecoderException e) { throw new AssertionError("Failed to decode URI: " + uri.toString()); } } private static URI convertKeyToEncodedUri(String key) { try { - String encodedKey = URIUtil.encodePath(key); - URI uri = new URI(encodedKey); - return uri; + return new URIBuilder().setPath(key).build(); } catch (URISyntaxException e) { throw new AssertionError("Failed to encode key: " + key); - } catch (URIException e) { - throw new AssertionError("Failed to encode key: " + key); } } @@ -149,11 +146,8 @@ public class MockStorageInterface extends StorageInterface { public CloudBlobContainerWrapper getContainerReference(String name) throws URISyntaxException, StorageException { String fullUri; - try { - fullUri = baseUriString + "/" + URIUtil.encodePath(name); - } catch (URIException e) { - throw new RuntimeException("problem encoding fullUri", e); - } + URIBuilder builder = new URIBuilder(baseUriString); + fullUri = builder.setPath(builder.getPath() + "/" + name).toString(); MockCloudBlobContainerWrapper container = new MockCloudBlobContainerWrapper( fullUri, name); @@ -243,8 +237,6 @@ public class MockStorageInterface extends StorageInterface { // helper to create full URIs for directory and blob. // use withTrailingSlash=true to get a good path for a directory. private String fullUriString(String relativePath, boolean withTrailingSlash) { - String fullUri; - String baseUri = this.baseUri; if (!baseUri.endsWith("/")) { baseUri += "/"; @@ -255,12 +247,11 @@ public class MockStorageInterface extends StorageInterface { } try { - fullUri = baseUri + URIUtil.encodePath(relativePath); - } catch (URIException e) { + URIBuilder builder = new URIBuilder(baseUri); + return builder.setPath(builder.getPath() + relativePath).toString(); + } catch (URISyntaxException e) { throw new RuntimeException("problem encoding fullUri", e); } - - return fullUri; } }