- // add cause
- if(throwable.getCause() != null) {
- childStatuses.add(new Status(IStatus.ERROR, pluginId, ""));
- childStatuses.add(new Status(IStatus.ERROR, pluginId, "Caused by : " + throwable.getCause().toString()));
- for (StackTraceElement ste : throwable.getCause().getStackTrace()) {
- // build & add status
- childStatuses.add(new Status(IStatus.ERROR, pluginId, "at " + ste.toString()));
+ for(Throwable th : ExceptionUtils.getThrowables(throwable)) {
+ // add main exception
+ if(thCount == 0) {
+ for (StackTraceElement ste : th.getStackTrace()) {
+ childStatuses.add(new Status(IStatus.ERROR, pluginId, " at " + ste.toString()));
+ }
+ } else {
+ // add recursive causes
+ if(th != null) {
+ childStatuses.add(new Status(IStatus.ERROR, pluginId, ""));
+ String msg = th.toString();
+ childStatuses.add(new Status(IStatus.ERROR, pluginId, "Caused by : " + msg));
+ int traceCount = 0;
+ for (StackTraceElement ste : th.getStackTrace()) {
+ // add only pre-defined number of trace elements
+ if(traceCount > maxTraces) {
+ childStatuses.add(new Status(IStatus.ERROR, pluginId, " ...."));
+ break;
+ }
+ // build & add status
+ childStatuses.add(new Status(IStatus.ERROR, pluginId, " at " + ste.toString()));
+ traceCount++;
+ }
+ }