From 31fc8c504eb6270f4b626a568ea1896745a586b9 Mon Sep 17 00:00:00 2001 From: Suresh Srinivas Date: Mon, 22 Oct 2012 16:01:58 +0000 Subject: [PATCH] HADOOP-8951. Merge 1400921 from trunk. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1400926 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../src/main/java/org/apache/hadoop/util/RunJar.java | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 8e4d686717a..0d9dae14e58 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -110,6 +110,9 @@ Release 2.0.3-alpha - Unreleased HADOOP-8948. TestFileUtil.testGetDU fails on Windows due to incorrect assumption of line separator. (Chris Nauroth via suresh) + HADOOP-8951. RunJar to fail with user-comprehensible error + message if jar missing. (stevel via suresh) + Release 2.0.2-alpha - 2012-09-07 INCOMPATIBLE CHANGES 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;