HADOOP-10135 writes to swift fs over partition size leave temp files and empty output file

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1546957 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Steve Loughran 2013-12-02 11:00:00 +00:00
parent ce913ffd49
commit 0293279c58
3 changed files with 20 additions and 1 deletions

View File

@ -161,6 +161,9 @@ Release 2.3.0 - UNRELEASED
HADOOP-10107. Server.getNumOpenConnections may throw NPE. (Kihwal Lee via HADOOP-10107. Server.getNumOpenConnections may throw NPE. (Kihwal Lee via
jing9) jing9)
HADOOP-10135 writes to swift fs over partition size leave temp files and
empty output file (David Dobbins via stevel)
Release 2.2.1 - UNRELEASED Release 2.2.1 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -51,8 +51,12 @@ public final class SwiftObjectPath {
*/ */
public SwiftObjectPath(String container, String object) { public SwiftObjectPath(String container, String object) {
if (object == null) {
throw new IllegalArgumentException("object name can't be null");
}
this.container = container; this.container = container;
this.object = object; this.object = URI.create(object).getPath();
uriPath = buildUriPath(); uriPath = buildUriPath();
} }

View File

@ -71,6 +71,18 @@ public class TestSwiftObjectPath implements SwiftTestConstants {
assertEquals(expected, actual); assertEquals(expected, actual);
} }
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testHandleUrlAsPath() throws Exception {
final String hostPart = "swift://container.service1";
final String pathPart = "/home/user/files/file1";
final String uriString = hostPart + pathPart;
final SwiftObjectPath expected = new SwiftObjectPath(uriString, pathPart);
final SwiftObjectPath actual = new SwiftObjectPath(uriString, uriString);
assertEquals(expected, actual);
}
@Test(timeout = SWIFT_TEST_TIMEOUT) @Test(timeout = SWIFT_TEST_TIMEOUT)
public void testParseAuthenticatedUrl() throws Exception { public void testParseAuthenticatedUrl() throws Exception {
final String pathString = "swift://container.service1/v2/AUTH_00345h34l93459y4/home/tom/documents/finance.docx"; final String pathString = "swift://container.service1/v2/AUTH_00345h34l93459y4/home/tom/documents/finance.docx";