Github user zsxwing commented on the pull request:

    https://github.com/apache/spark/pull/5130#issuecomment-84860442
  
    > Do InvocationTargetExceptions only wrap Exceptions and not all Throwables?
    
    It will wrap Error, too. Run the following codes in my machine, 
    
    ```Scala
    class Foo {}
    
    object Foo {
    
      def main(args: Array[String]): Unit = {
        val a = ArrayBuffer[String]()
        while(true) {
          a += "111111111111111111111111111111"
        }
      }
    }
    
    object Bar {
    
      def main(args: Array[String]): Unit = {
        val mainMethod = classOf[Foo].getMethod("main", classOf[Array[String]])
        mainMethod.invoke(null, null)
      }
    
    }
    ```
    and it outputs,
    
    ```
    Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at Bar$.main(Nio.scala:72)
        at Bar.main(Nio.scala)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
    Caused by: java.lang.OutOfMemoryError: Java heap space
        at 
scala.collection.mutable.ResizableArray$class.ensureSize(ResizableArray.scala:99)
        at scala.collection.mutable.ArrayBuffer.ensureSize(ArrayBuffer.scala:47)
        at scala.collection.mutable.ArrayBuffer.$plus$eq(ArrayBuffer.scala:83)
        at Foo$.main(Nio.scala:62)
        at Foo.main(Nio.scala)
        ... 11 more
    
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to