1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-23 02:58:00 +01:00

Added getMessage() method, improved stack traces.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2139 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2003-10-13 20:42:22 +00:00 committed by mtucker
parent e5f76b3e40
commit 3451c8880d

View file

@ -172,9 +172,6 @@ public class XMPPException extends Exception {
}
public void printStackTrace(PrintStream out) {
if (error != null) {
System.err.print(error + " -- ");
}
super.printStackTrace(out);
if (wrappedThrowable != null) {
out.println("Nested Exception: ");
@ -183,9 +180,6 @@ public class XMPPException extends Exception {
}
public void printStackTrace(PrintWriter out) {
if (error != null) {
System.err.print(error + " -- ");
}
super.printStackTrace(out);
if (wrappedThrowable != null) {
out.println("Nested Exception: ");
@ -193,11 +187,24 @@ public class XMPPException extends Exception {
}
}
public String getMessage() {
String msg = super.getMessage();
// If the message was not set, but there is an XMPPError, return the
// XMPPError as the message.
if (msg == null && error != null) {
return error.toString();
}
return msg;
}
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append(super.toString());
String message = super.getMessage();
if (message != null) {
buf.append(message).append(": ");
}
if (error != null) {
buf.append(": ").append(error);
buf.append(error);
}
if (wrappedThrowable != null) {
buf.append("\n -- caused by: ").append(wrappedThrowable);