svn merge -c 1494331 FIXES: HADOOP-9582. Non-existent file to "hadoop fs -conf" doesn't throw error. Contributed by Ashwin Shankar
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1494336 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
68d97a6aac
commit
89fb4a48f8
|
@ -12,6 +12,9 @@ Release 2.3.0 - UNRELEASED
|
|||
|
||||
BUG FIXES
|
||||
|
||||
HADOOP-9582. Non-existent file to "hadoop fs -conf" doesn't throw error
|
||||
(Ashwin Shankar via jlowe)
|
||||
|
||||
Release 2.2.0 - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
@ -1504,6 +1507,12 @@ Release 0.23.9 - UNRELEASED
|
|||
|
||||
BUG FIXES
|
||||
|
||||
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
|
||||
|
|
|
@ -1874,7 +1874,7 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
|
|||
private Document parse(DocumentBuilder builder, URL url)
|
||||
throws IOException, SAXException {
|
||||
if (!quietmode) {
|
||||
LOG.info("parsing URL " + url);
|
||||
LOG.debug("parsing URL " + url);
|
||||
}
|
||||
if (url == null) {
|
||||
return null;
|
||||
|
@ -1885,7 +1885,7 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
|
|||
private Document parse(DocumentBuilder builder, InputStream is,
|
||||
String systemId) throws IOException, SAXException {
|
||||
if (!quietmode) {
|
||||
LOG.info("parsing input stream " + is);
|
||||
LOG.debug("parsing input stream " + is);
|
||||
}
|
||||
if (is == null) {
|
||||
return null;
|
||||
|
@ -1958,7 +1958,7 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
|
|||
.getAbsoluteFile();
|
||||
if (file.exists()) {
|
||||
if (!quiet) {
|
||||
LOG.info("parsing File " + file);
|
||||
LOG.debug("parsing File " + file);
|
||||
}
|
||||
doc = parse(builder, new BufferedInputStream(
|
||||
new FileInputStream(file)), ((Path)resource).toString());
|
||||
|
|
|
@ -300,6 +300,9 @@ public class FsShell extends Configured implements Tool {
|
|||
*/
|
||||
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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue