diff --git a/java/src/processing/mode/java/runner/Runner.java b/java/src/processing/mode/java/runner/Runner.java index 6af2aad30..54a59500a 100644 --- a/java/src/processing/mode/java/runner/Runner.java +++ b/java/src/processing/mode/java/runner/Runner.java @@ -749,6 +749,12 @@ public class Runner implements MessageConsumer { // This shouldn't happen, but if it does, print the exception in case // it's something that needs to be debugged separately. e.printStackTrace(sketchErr); + } catch (Exception e) { + // stack overflows seem to trip in frame.location() above + // ignore this case so that the actual error gets reported to the user + if ("StackOverflowError".equals(message) == false) { + e.printStackTrace(sketchErr); + } } // before giving up, try to extract from the throwable object itself // since sometimes exceptions are re-thrown from a different context @@ -780,7 +786,11 @@ public class Runner implements MessageConsumer { or.invokeMethod(thread, method, new ArrayList(), ObjectReference.INVOKE_SINGLE_THREADED); } catch (Exception e) { - e.printStackTrace(sketchErr); + // stack overflows will make the exception handling above trip again + // ignore this case so that the actual error gets reported to the user + if ("StackOverflowError".equals(message) == false) { + e.printStackTrace(sketchErr); + } } // Give up, nothing found inside the pile of stack frames SketchException rex = new SketchException(message);