HADOOP-8951. RunJar to fail with user-comprehensible error message if jar missing. Contributed by Steve Loughran.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1400921 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Suresh Srinivas 2012-10-22 15:55:04 +00:00
parent 35ec20b7c6
commit 0dc2681900
2 changed files with 7 additions and 0 deletions

View File

@ -269,6 +269,9 @@ Trunk (Unreleased)
HADOOP-8918. test-patch.sh is parsing modified files wrong. HADOOP-8918. test-patch.sh is parsing modified files wrong.
(Raja Aluri via suresh) (Raja Aluri via suresh)
HADOOP-8951. RunJar to fail with user-comprehensible error
message if jar missing. (stevel via suresh)
OPTIMIZATIONS OPTIMIZATIONS
HADOOP-7761. Improve the performance of raw comparisons. (todd) HADOOP-7761. Improve the performance of raw comparisons. (todd)

View File

@ -126,6 +126,10 @@ public class RunJar {
int firstArg = 0; int firstArg = 0;
String fileName = args[firstArg++]; String fileName = args[firstArg++];
File file = new File(fileName); File file = new File(fileName);
if (!file.exists() || !file.isFile()) {
System.err.println("Not a valid JAR: " + file.getCanonicalPath());
System.exit(-1);
}
String mainClassName = null; String mainClassName = null;
JarFile jarFile; JarFile jarFile;