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/trunk@1494331 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
40cab68409
commit
3ab7f86c16
@ -354,6 +354,33 @@ Trunk (Unreleased)
|
||||
HADOOP-9190. packaging docs is broken. (Andy Isaacson via atm)
|
||||
|
||||
|
||||
Release 2.3.0 - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
||||
NEW FEATURES
|
||||
|
||||
IMPROVEMENTS
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
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
|
||||
|
||||
NEW FEATURES
|
||||
|
||||
IMPROVEMENTS
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
BUG FIXES
|
||||
|
||||
Release 2.1.0-beta - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
@ -1804,6 +1831,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
|
||||
|
@ -1970,7 +1970,7 @@ public Iterator<Map.Entry<String, String>> iterator() {
|
||||
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;
|
||||
@ -1981,7 +1981,7 @@ private Document parse(DocumentBuilder builder, URL url)
|
||||
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;
|
||||
@ -2054,7 +2054,7 @@ private Resource loadResource(Properties properties, Resource wrapper, boolean q
|
||||
.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 void close() throws IOException {
|
||||
*/
|
||||
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
Block a user