From 867e1714ad24bbe330c338183fc371121fd67581 Mon Sep 17 00:00:00 2001 From: Matt Tucker Date: Fri, 7 Mar 2003 19:47:31 +0000 Subject: [PATCH] Support for XMPPError class. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@1842 b35dd754-fafc-0310-a699-88a17e54d16e --- .../org/jivesoftware/smack/XMPPException.java | 40 +++++++++++++++---- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/source/org/jivesoftware/smack/XMPPException.java b/source/org/jivesoftware/smack/XMPPException.java index b9cbe27bd..2f41cf944 100644 --- a/source/org/jivesoftware/smack/XMPPException.java +++ b/source/org/jivesoftware/smack/XMPPException.java @@ -63,7 +63,8 @@ import java.io.PrintWriter; */ public class XMPPException extends Exception { - private Throwable cause; + private Error error = null; + private Throwable cause = null; public XMPPException() { super(); @@ -78,26 +79,51 @@ public class XMPPException extends Exception { this.cause = cause; } + public XMPPException(Error error) { + super(); + this.error = error; + } + public XMPPException(String message, Throwable cause) { super(message); this.cause = cause; } + public XMPPException(String message, Error error) { + super(message); + this.error = error; + } + public void printStackTrace() { + if (error != null) { + System.err.println(error); + } super.printStackTrace(); - System.err.println("Nested Exception: "); - cause.printStackTrace(); + if (cause != null) { + System.err.println("Nested Exception: "); + cause.printStackTrace(); + } } public void printStackTrace(PrintStream out) { + if (error != null) { + System.err.println(error); + } super.printStackTrace(out); - out.println("Nested Exception: "); - cause.printStackTrace(out); + if (cause != null) { + out.println("Nested Exception: "); + cause.printStackTrace(out); + } } public void printStackTrace(PrintWriter out) { + if (error != null) { + System.err.println(error); + } super.printStackTrace(out); - out.println("Nested Exception: "); - cause.printStackTrace(out); + if (cause != null) { + out.println("Nested Exception: "); + cause.printStackTrace(out); + } } }