Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public TransactionException(final String message,
@Override
public synchronized Throwable getCause()
{
return this.causes.isEmpty() ? super.getCause() : this.causes.get(0);
return (this.causes == null || this.causes.isEmpty()) ? super.getCause() : this.causes.get(0);
}

/**
Expand Down Expand Up @@ -208,20 +208,22 @@ private void printInfo(final PrintWriter writeTo, final boolean includeStackTrac
}
writeTo.println("Caused by:");

for (Throwable cause : causes) {

writeTo.println(cause.getClass().getName());
writeTo.print(TAB);
writeTo.print(("" + cause.getMessage()).replaceAll(NEWLINE, NEWLINE + TAB));
writeTo.print(NEWLINE);

if (includeStackTrace) {
// Include the stack trace tabbed in for each so they are recognizable as different.
// TODO End the stack trace at the frame which caused the TransactionException to throw.
final Writer stw = new StringWriter();
final PrintWriter stpw = new PrintWriter(stw);
cause.printStackTrace(stpw);
writeTo.print(stw.toString().replaceAll(NEWLINE, NEWLINE + TAB));
if (causes != null) {
for (Throwable cause : causes) {

writeTo.println(cause.getClass().getName());
writeTo.print(TAB);
writeTo.print(("" + cause.getMessage()).replaceAll(NEWLINE, NEWLINE + TAB));
writeTo.print(NEWLINE);

if (includeStackTrace) {
// Include the stack trace tabbed in for each so they are recognizable as different.
// TODO End the stack trace at the frame which caused the TransactionException to throw.
final Writer stw = new StringWriter();
final PrintWriter stpw = new PrintWriter(stw);
cause.printStackTrace(stpw);
writeTo.print(stw.toString().replaceAll(NEWLINE, NEWLINE + TAB));
}
}
}
if (includeStackTrace) {
Expand Down