aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandeep <sandeep@techaddict.me>2014-05-04 20:51:53 -0700
committerPatrick Wendell <pwendell@gmail.com>2014-05-04 20:51:53 -0700
commitb48a55ae9ff2976c5fe6f5776a6d4659e828ee24 (patch)
treec87cadafd86235eaa081ee13c463098ff999450a
parentbcb9b7fd4a656f9a6741220a6623441567ded0a4 (diff)
downloadspark-b48a55ae9ff2976c5fe6f5776a6d4659e828ee24.tar.gz
spark-b48a55ae9ff2976c5fe6f5776a6d4659e828ee24.tar.bz2
spark-b48a55ae9ff2976c5fe6f5776a6d4659e828ee24.zip
SPARK-1710: spark-submit should print better errors than "InvocationTargetException"
Catching the InvocationTargetException, printing getTargetException. Author: Sandeep <sandeep@techaddict.me> Closes #630 from techaddict/SPARK-1710 and squashes the following commits: 834d79b [Sandeep] changes from srowen suggestions 109d604 [Sandeep] SPARK-1710: spark-submit should print better errors than "InvocationTargetException"
-rw-r--r--core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala12
1 files changed, 10 insertions, 2 deletions
diff --git a/core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala b/core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala
index d131f1809c..fb30e8a70f 100644
--- a/core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala
+++ b/core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala
@@ -18,6 +18,7 @@
package org.apache.spark.deploy
import java.io.{File, PrintStream}
+import java.lang.reflect.InvocationTargetException
import java.net.{URI, URL}
import scala.collection.mutable.{ArrayBuffer, HashMap, Map}
@@ -137,7 +138,7 @@ object SparkSubmit {
throw new Exception(msg)
}
}
-
+
// Special flag to avoid deprecation warnings at the client
sysProps("SPARK_SUBMIT") = "true"
@@ -253,7 +254,14 @@ object SparkSubmit {
val mainClass = Class.forName(childMainClass, true, loader)
val mainMethod = mainClass.getMethod("main", new Array[String](0).getClass)
- mainMethod.invoke(null, childArgs.toArray)
+ try {
+ mainMethod.invoke(null, childArgs.toArray)
+ } catch {
+ case e: InvocationTargetException => e.getCause match {
+ case cause: Throwable => throw cause
+ case null => throw e
+ }
+ }
}
private def addJarToClasspath(localJar: String, loader: ExecutorURLClassLoader) {