You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by jl...@apache.org on 2013/06/19 00:12:12 UTC

svn commit: r1494338 - in /hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common: ./ src/main/java/org/apache/hadoop/conf/ src/main/java/org/apache/hadoop/fs/ src/test/java/org/apache/hadoop/fs/

Author: jlowe
Date: Tue Jun 18 22:12:11 2013
New Revision: 1494338

URL: http://svn.apache.org/r1494338
Log:
HADOOP-9582. Non-existent file to "hadoop fs -conf" doesn't throw error. Contributed by Ashwin Shankar

Added:
    hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFsShell.java
Modified:
    hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/CHANGES.txt
    hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java
    hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FsShell.java

Modified: hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1494338&r1=1494337&r2=1494338&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/CHANGES.txt Tue Jun 18 22:12:11 2013
@@ -15,6 +15,9 @@ Release 0.23.9 - UNRELEASED
     HADOOP-9581. hadoop --config non-existent directory should result in error
     (Ashwin Shankar via jlowe)
 
+    HADOOP-9582. Non-existent file to "hadoop fs -conf" doesn't throw error
+    (Ashwin Shankar via jlowe)
+    
 Release 0.23.8 - 2013-06-05
   
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java?rev=1494338&r1=1494337&r2=1494338&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java (original)
+++ hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java Tue Jun 18 22:12:11 2013
@@ -1844,7 +1844,7 @@ public class Configuration implements It
         URL url = (URL)resource;
         if (url != null) {
           if (!quiet) {
-            LOG.info("parsing " + url);
+            LOG.debug("parsing " + url);
           }
           doc = builder.parse(url.toString());
         }
@@ -1852,7 +1852,7 @@ public class Configuration implements It
         URL url = getResource((String)resource);
         if (url != null) {
           if (!quiet) {
-            LOG.info("parsing " + url);
+            LOG.debug("parsing " + url);
           }
           doc = builder.parse(url.toString());
         }
@@ -1863,7 +1863,7 @@ public class Configuration implements It
           .getAbsoluteFile();
         if (file.exists()) {
           if (!quiet) {
-            LOG.info("parsing " + file);
+            LOG.debug("parsing " + file);
           }
           InputStream in = new BufferedInputStream(new FileInputStream(file));
           try {

Modified: hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FsShell.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FsShell.java?rev=1494338&r1=1494337&r2=1494338&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FsShell.java (original)
+++ hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FsShell.java Tue Jun 18 22:12:11 2013
@@ -299,6 +299,9 @@ public class FsShell extends Configured 
    */
   public static void main(String argv[]) throws Exception {
     FsShell shell = newShellInstance();
+    Configuration conf = new Configuration();
+    conf.setQuietMode(false);
+    shell.setConf(conf);
     int res;
     try {
       res = ToolRunner.run(shell, argv);

Added: hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFsShell.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFsShell.java?rev=1494338&view=auto
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFsShell.java (added)
+++ hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFsShell.java Tue Jun 18 22:12:11 2013
@@ -0,0 +1,42 @@
+/**
+ * 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;
+
+import junit.framework.AssertionFailedError;
+import org.junit.Test;
+
+public class TestFsShell {
+
+  @Test
+  public void testConfWithInvalidFile() throws Throwable {
+    String[] args = new String[1];
+    args[0] = "--conf=invalidFile";
+    Throwable th = null;
+    try {
+      FsShell.main(args);
+    } catch (Exception e) {
+      th = e;
+    }
+
+    if (!(th instanceof RuntimeException)) {
+      throw new AssertionFailedError("Expected Runtime exception, got: " + th)
+          .initCause(th);
+    }
+  }
+
+}