[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hadoop-commits
Subject:    svn commit: r652125 - in /hadoop/core/trunk: CHANGES.txt
From:       omalley () apache ! org
Date:       2008-04-29 21:09:27
Message-ID: 20080429210927.C219F23889C4 () eris ! apache ! org
[Download RAW message or body]

Author: omalley
Date: Tue Apr 29 14:09:27 2008
New Revision: 652125

URL: http://svn.apache.org/viewvc?rev=652125&view=rev
Log:
HADOOP-3301. Fix misleading error message when S3 URI hostname
contains an underscore. Contributed by Tom White.

Added:
    hadoop/core/trunk/src/test/org/apache/hadoop/fs/s3/TestS3Uri.java
Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=652125&r1=652124&r2=652125&view=diff
 ==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Tue Apr 29 14:09:27 2008
@@ -105,6 +105,9 @@
     HADOOP-3318. Recognize "Darwin" as an alias for "Mac OS X" to
     support Soylatte. (Sam Pullara via omalley)
 
+    HADOOP-3301. Fix misleading error message when S3 URI hostname
+    contains an underscore. (tomwhite via omalley)
+
 Release 0.17.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java
                
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java?rev=652125&r1=652124&r2=652125&view=diff
 ==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java \
                (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java Tue \
Apr 29 14:09:27 2008 @@ -78,6 +78,10 @@
     
     this.conf = conf;
     
+    if (uri.getHost() == null) {
+      throw new IllegalArgumentException("Invalid hostname in URI " + uri); 
+    }
+    
     try {
       String accessKey = null;
       String secretAccessKey = null;

Added: hadoop/core/trunk/src/test/org/apache/hadoop/fs/s3/TestS3Uri.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/fs/s3/TestS3Uri.java?rev=652125&view=auto
 ==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/fs/s3/TestS3Uri.java (added)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/fs/s3/TestS3Uri.java Tue Apr 29 \
14:09:27 2008 @@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.fs.s3;
+
+import java.net.URI;
+
+import junit.framework.TestCase;
+
+import org.apache.hadoop.conf.Configuration;
+
+public class TestS3Uri extends TestCase {
+  public void testInvalidHostnameWithUnderscores() throws Exception {
+    FileSystemStore store = new Jets3tFileSystemStore();
+    try {
+      store.initialize(new URI("s3://a:b@c_d"), new Configuration());
+      fail("Should throw IllegalArgumentException");
+    } catch (IllegalArgumentException e) {
+      assertEquals("Invalid hostname in URI s3://a:b@c_d", e.getMessage());
+    }
+  }
+}


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic