From 69e5ebb410498e67ed4865b2afcd6f5dfaf0541f Mon Sep 17 00:00:00 2001 From: "taylor.smock" Date: Thu, 17 Oct 2024 13:29:50 +0000 Subject: [PATCH] Fix #23920: Wrapped ReportedException don't keep data on bug report git-svn-id: https://josm.openstreetmap.de/svn/trunk@19246 0c6e7542-c601-0410-84e7-c038aed88b3b --- .../openstreetmap/josm/tools/bugreport/BugReport.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/org/openstreetmap/josm/tools/bugreport/BugReport.java b/src/org/openstreetmap/josm/tools/bugreport/BugReport.java index 36b376e3b71..a9b33292326 100644 --- a/src/org/openstreetmap/josm/tools/bugreport/BugReport.java +++ b/src/org/openstreetmap/josm/tools/bugreport/BugReport.java @@ -159,6 +159,15 @@ public String getReportText(String header) { } if (isIncludeData()) { exception.printReportDataTo(out); + // Exceptions thrown in threads *may* be automatically wrapped by the thread handler (ForkJoinPool, etc.) + // We want to keep the data saved in the child exceptions, so we print that as well. + Throwable cause = exception.getCause(); + while (cause != null) { + if (cause instanceof ReportedException) { + ((ReportedException) cause).printReportDataTo(out); + } + cause = cause.getCause(); + } } exception.printReportStackTo(out); if (isIncludeAllStackTraces()) {