List of usage examples for java.lang Throwable setCause
final void setCause(Throwable t)
From source file:org.eclipse.epp.internal.logging.aeri.ui.model.Reports.java
public static Throwable newThrowable(java.lang.Throwable throwable) { Throwable mThrowable = factory.createThrowable(); mThrowable.setMessage(throwable.getMessage()); mThrowable.setClassName(throwable.getClass().getName()); List<StackTraceElement> mStackTrace = mThrowable.getStackTrace(); for (java.lang.StackTraceElement stackTraceElement : throwable.getStackTrace()) { StackTraceElement mStackTraceElement = factory.createStackTraceElement(); mStackTraceElement.setFileName(stackTraceElement.getFileName()); mStackTraceElement.setClassName(ensureNotBlank(stackTraceElement.getClassName(), throwable)); mStackTraceElement.setMethodName(ensureNotBlank(stackTraceElement.getMethodName(), throwable)); mStackTraceElement.setLineNumber(stackTraceElement.getLineNumber()); mStackTraceElement.setNative(stackTraceElement.isNativeMethod()); mStackTrace.add(mStackTraceElement); }/*from w ww. j a v a2 s.com*/ java.lang.Throwable cause = throwable.getCause(); if (cause != null) { if (cause == throwable) { log(WARN_CYCLIC_EXCEPTION, cause.toString()); return mThrowable; } mThrowable.setCause(newThrowable(cause)); } return mThrowable; }