5 |
5 |
import java.util.ArrayList;
|
6 |
6 |
import java.util.List;
|
7 |
7 |
|
|
8 |
import org.apache.commons.lang.exception.ExceptionUtils;
|
8 |
9 |
import org.apache.log4j.Logger;
|
9 |
10 |
import org.eclipse.core.runtime.IStatus;
|
10 |
11 |
import org.eclipse.core.runtime.MultiStatus;
|
... | ... | |
293 |
294 |
throwable = getDefaultThrowable();
|
294 |
295 |
}
|
295 |
296 |
|
296 |
|
// add main execption
|
297 |
|
for (StackTraceElement ste : throwable.getStackTrace()) {
|
298 |
|
childStatuses.add(new Status(IStatus.ERROR, pluginId, "at " + ste.toString()));
|
299 |
|
}
|
|
297 |
int thCount = 0;
|
|
298 |
int maxTraces = 4;
|
300 |
299 |
|
301 |
|
// add cause
|
302 |
|
if(throwable.getCause() != null) {
|
303 |
|
childStatuses.add(new Status(IStatus.ERROR, pluginId, ""));
|
304 |
|
childStatuses.add(new Status(IStatus.ERROR, pluginId, "Caused by : " + throwable.getCause().toString()));
|
305 |
|
for (StackTraceElement ste : throwable.getCause().getStackTrace()) {
|
306 |
|
// build & add status
|
307 |
|
childStatuses.add(new Status(IStatus.ERROR, pluginId, "at " + ste.toString()));
|
|
300 |
for(Throwable th : ExceptionUtils.getThrowables(throwable)) {
|
|
301 |
// add main exception
|
|
302 |
if(thCount == 0) {
|
|
303 |
for (StackTraceElement ste : th.getStackTrace()) {
|
|
304 |
childStatuses.add(new Status(IStatus.ERROR, pluginId, " at " + ste.toString()));
|
|
305 |
}
|
|
306 |
} else {
|
|
307 |
// add recursive causes
|
|
308 |
if(th != null) {
|
|
309 |
childStatuses.add(new Status(IStatus.ERROR, pluginId, ""));
|
|
310 |
String msg = th.toString();
|
|
311 |
childStatuses.add(new Status(IStatus.ERROR, pluginId, "Caused by : " + msg));
|
|
312 |
int traceCount = 0;
|
|
313 |
for (StackTraceElement ste : th.getStackTrace()) {
|
|
314 |
// add only pre-defined number of trace elements
|
|
315 |
if(traceCount > maxTraces) {
|
|
316 |
childStatuses.add(new Status(IStatus.ERROR, pluginId, " ...."));
|
|
317 |
break;
|
|
318 |
}
|
|
319 |
// build & add status
|
|
320 |
childStatuses.add(new Status(IStatus.ERROR, pluginId, " at " + ste.toString()));
|
|
321 |
traceCount++;
|
|
322 |
}
|
|
323 |
}
|
308 |
324 |
}
|
|
325 |
thCount++;
|
309 |
326 |
}
|
310 |
|
|
311 |
327 |
String finalMessage = message;
|
312 |
328 |
|
313 |
329 |
if(finalMessage == null || finalMessage.isEmpty()) {
|
MANIFEST.MF : added apache commons exception package for use in messaging utils
MessagingUtils : updated to add all causes in the child statuses