Skip to content

Commit 7e68b64

Browse files
author
Ivan Mitic
committed
HADOOP-9776. Merging change r1526109 from trunk
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1526110 13f79535-47bb-0310-9956-ffa450edef68
1 parent bd25735 commit 7e68b64

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

hadoop-common-project/hadoop-common/CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ Release 2.1.2 - UNRELEASED
108108

109109
BUG FIXES
110110

111+
HADOOP-9776. HarFileSystem.listStatus() returns invalid authority if port
112+
number is empty. (Shanyu Zhao via ivanmi)
113+
111114
Release 2.1.1-beta - 2013-09-23
112115

113116
INCOMPATIBLE CHANGES

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,9 @@ public Path getWorkingDirectory() {
283283
private String getHarAuth(URI underLyingUri) {
284284
String auth = underLyingUri.getScheme() + "-";
285285
if (underLyingUri.getHost() != null) {
286-
auth += underLyingUri.getHost() + ":";
286+
auth += underLyingUri.getHost();
287287
if (underLyingUri.getPort() != -1) {
288+
auth += ":";
288289
auth += underLyingUri.getPort();
289290
}
290291
}

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestHarFileSystemBasics.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,17 @@ public void testPositiveInitWithoutUnderlyingFS() throws Exception {
221221
hfs.initialize(uri, new Configuration());
222222
}
223223

224+
@Test
225+
public void testPositiveListFilesNotEndInColon() throws Exception {
226+
// re-initialize the har file system with host name
227+
// make sure the qualified path name does not append ":" at the end of host name
228+
final URI uri = new URI("har://file-localhost" + harPath.toString());
229+
harFileSystem.initialize(uri, conf);
230+
Path p1 = new Path("har://file-localhost" + harPath.toString());
231+
Path p2 = harFileSystem.makeQualified(p1);
232+
assertTrue(p2.toUri().toString().startsWith("har://file-localhost/"));
233+
}
234+
224235
// ========== Negative:
225236

226237
@Test

0 commit comments

Comments
 (0)