You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by pw...@apache.org on 2014/05/05 05:52:00 UTC

git commit: SPARK-1710: spark-submit should print better errors than "InvocationTargetException"

Repository: spark
Updated Branches:
  refs/heads/master bcb9b7fd4 -> b48a55ae9


SPARK-1710: spark-submit should print better errors than "InvocationTargetException"

Catching the InvocationTargetException, printing getTargetException.

Author: Sandeep <sa...@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"


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/b48a55ae
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/b48a55ae
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/b48a55ae

Branch: refs/heads/master
Commit: b48a55ae9ff2976c5fe6f5776a6d4659e828ee24
Parents: bcb9b7f
Author: Sandeep <sa...@techaddict.me>
Authored: Sun May 4 20:51:53 2014 -0700
Committer: Patrick Wendell <pw...@gmail.com>
Committed: Sun May 4 20:51:53 2014 -0700

----------------------------------------------------------------------
 .../scala/org/apache/spark/deploy/SparkSubmit.scala     | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/b48a55ae/core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala
----------------------------------------------------------------------
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 d131f18..fb30e8a 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) {