diff --git a/java/src/processing/mode/java/runner/Runner.java b/java/src/processing/mode/java/runner/Runner.java index 0da295f7a..1e1bd5b47 100644 --- a/java/src/processing/mode/java/runner/Runner.java +++ b/java/src/processing/mode/java/runner/Runner.java @@ -747,6 +747,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 @@ -778,7 +784,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);