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:[EMAIL PROTECTED]"), new
Configuration());
+ fail("Should throw IllegalArgumentException");
+ } catch (IllegalArgumentException e) {
+ assertEquals("Invalid hostname in URI s3://a:[EMAIL PROTECTED]",
e.getMessage());
+ }
+ }
+}