diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 84d573115f7..20bd2df27d8 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -269,6 +269,9 @@ Trunk (Unreleased) HADOOP-8918. test-patch.sh is parsing modified files wrong. (Raja Aluri via suresh) + HADOOP-8951. RunJar to fail with user-comprehensible error + message if jar missing. (stevel via suresh) + OPTIMIZATIONS HADOOP-7761. Improve the performance of raw comparisons. (todd) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/RunJar.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/RunJar.java index 7211b5bd706..ec1c6d84c0e 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/RunJar.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/RunJar.java @@ -126,6 +126,10 @@ public class RunJar { int firstArg = 0; String fileName = args[firstArg++]; 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; JarFile jarFile;