hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1547122 - in /hadoop/common/branches/HDFS-2832: ./ hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/util/ hadoop-tools/hadoop-openstack/src/test/java/org/apache/hadoop/fs/swift/
Date Mon, 02 Dec 2013 17:41:47 GMT
Author: arp
Date: Mon Dec  2 17:41:44 2013
New Revision: 1547122

URL: http://svn.apache.org/r1547122
Log:
Merging r1544666 through r1547120 from trunk to branch HDFS-2832

Modified:
    hadoop/common/branches/HDFS-2832/   (props changed)
    hadoop/common/branches/HDFS-2832/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/util/SwiftObjectPath.java
    hadoop/common/branches/HDFS-2832/hadoop-tools/hadoop-openstack/src/test/java/org/apache/hadoop/fs/swift/TestSwiftObjectPath.java

Propchange: hadoop/common/branches/HDFS-2832/
------------------------------------------------------------------------------
  Merged /hadoop/common/branches/branch-2:r1546957
  Merged /hadoop/common/trunk:r1544666-1547120

Modified: hadoop/common/branches/HDFS-2832/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/util/SwiftObjectPath.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2832/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/util/SwiftObjectPath.java?rev=1547122&r1=1547121&r2=1547122&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-2832/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/util/SwiftObjectPath.java
(original)
+++ hadoop/common/branches/HDFS-2832/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/util/SwiftObjectPath.java
Mon Dec  2 17:41:44 2013
@@ -51,8 +51,12 @@ public final class SwiftObjectPath {
    */
   public SwiftObjectPath(String container, String object) {
 
+    if (object == null) {
+      throw new IllegalArgumentException("object name can't be null");
+    }
+
     this.container = container;
-    this.object = object;
+    this.object = URI.create(object).getPath();
     uriPath = buildUriPath();
   }
 

Modified: hadoop/common/branches/HDFS-2832/hadoop-tools/hadoop-openstack/src/test/java/org/apache/hadoop/fs/swift/TestSwiftObjectPath.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2832/hadoop-tools/hadoop-openstack/src/test/java/org/apache/hadoop/fs/swift/TestSwiftObjectPath.java?rev=1547122&r1=1547121&r2=1547122&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-2832/hadoop-tools/hadoop-openstack/src/test/java/org/apache/hadoop/fs/swift/TestSwiftObjectPath.java
(original)
+++ hadoop/common/branches/HDFS-2832/hadoop-tools/hadoop-openstack/src/test/java/org/apache/hadoop/fs/swift/TestSwiftObjectPath.java
Mon Dec  2 17:41:44 2013
@@ -72,6 +72,18 @@ public class TestSwiftObjectPath impleme
   }
 
   @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)
   public void testParseAuthenticatedUrl() throws Exception {
     final String pathString = "swift://container.service1/v2/AUTH_00345h34l93459y4/home/tom/documents/finance.docx";
     final URI uri = new URI(pathString);



Mime
View raw message