mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-29 17:52:06 +01:00
Added getters and improved comments.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@1852 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
9287e1b989
commit
f0ef12eed5
1 changed files with 67 additions and 10 deletions
|
@ -59,43 +59,100 @@ import java.io.PrintWriter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A generic exception that is thrown when an error occurs performing an
|
* A generic exception that is thrown when an error occurs performing an
|
||||||
* XMPP operation.
|
* XMPP operation. XMPP servers can respond to error conditions with an error code
|
||||||
|
* and textual description of the problem, which are encapsulated in the XMPPError
|
||||||
|
* class. When appropriate, an XMPPError instance is attached instances of this exception.
|
||||||
*
|
*
|
||||||
|
* @see XMPPError
|
||||||
* @author Matt Tucker
|
* @author Matt Tucker
|
||||||
*/
|
*/
|
||||||
public class XMPPException extends Exception {
|
public class XMPPException extends Exception {
|
||||||
|
|
||||||
private XMPPError error = null;
|
private XMPPError error = null;
|
||||||
private Throwable cause = null;
|
private Throwable wrappedThrowable = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new XMPPException.
|
||||||
|
*/
|
||||||
public XMPPException() {
|
public XMPPException() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new XMPPException with a description of the exception.
|
||||||
|
*
|
||||||
|
* @param message description of the exception.
|
||||||
|
*/
|
||||||
public XMPPException(String message) {
|
public XMPPException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public XMPPException(Throwable cause) {
|
/**
|
||||||
|
* Creates a new XMPPException with the Throwable that was the root cause of the
|
||||||
|
* exception.
|
||||||
|
*
|
||||||
|
* @param wrappedThrowable the root cause of the exception.
|
||||||
|
*/
|
||||||
|
public XMPPException(Throwable wrappedThrowable) {
|
||||||
super();
|
super();
|
||||||
this.cause = cause;
|
this.wrappedThrowable = wrappedThrowable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cretaes a new XMPPException with the XMPPError that was the root case of the
|
||||||
|
* exception.
|
||||||
|
*
|
||||||
|
* @param error the root cause of the exception.
|
||||||
|
*/
|
||||||
public XMPPException(XMPPError error) {
|
public XMPPException(XMPPError error) {
|
||||||
super();
|
super();
|
||||||
this.error = error;
|
this.error = error;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XMPPException(String message, Throwable cause) {
|
/**
|
||||||
|
* Creates a new XMPPException with a description of the exception and the
|
||||||
|
* Throwable that was the root cause of the exception.
|
||||||
|
*
|
||||||
|
* @param message a description of the exception.
|
||||||
|
* @param wrappedThrowable the root cause of the exception.
|
||||||
|
*/
|
||||||
|
public XMPPException(String message, Throwable wrappedThrowable) {
|
||||||
super(message);
|
super(message);
|
||||||
this.cause = cause;
|
this.wrappedThrowable = wrappedThrowable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new XMPPException with a description of the exception and the
|
||||||
|
* XMPPException that was the root cause of the exception.
|
||||||
|
*
|
||||||
|
* @param message a description of the exception.
|
||||||
|
* @param error the root cause of the exception.
|
||||||
|
*/
|
||||||
public XMPPException(String message, XMPPError error) {
|
public XMPPException(String message, XMPPError error) {
|
||||||
super(message);
|
super(message);
|
||||||
this.error = error;
|
this.error = error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the XMPPError asscociated with this exception, or <tt>null</tt> if there
|
||||||
|
* isn't one.
|
||||||
|
*
|
||||||
|
* @return the XMPPError asscociated with this exception.
|
||||||
|
*/
|
||||||
|
public XMPPError getXMPPError() {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Throwable asscociated with this exception, or <tt>null</tt> if there
|
||||||
|
* isn't one.
|
||||||
|
*
|
||||||
|
* @return the Throwable asscociated with this exception.
|
||||||
|
*/
|
||||||
|
public Throwable getWrappedThrowable() {
|
||||||
|
return wrappedThrowable;
|
||||||
|
}
|
||||||
|
|
||||||
public void printStackTrace() {
|
public void printStackTrace() {
|
||||||
printStackTrace(System.err);
|
printStackTrace(System.err);
|
||||||
}
|
}
|
||||||
|
@ -105,9 +162,9 @@ public class XMPPException extends Exception {
|
||||||
System.err.print(error + " -- ");
|
System.err.print(error + " -- ");
|
||||||
}
|
}
|
||||||
super.printStackTrace(out);
|
super.printStackTrace(out);
|
||||||
if (cause != null) {
|
if (wrappedThrowable != null) {
|
||||||
out.println("Nested Exception: ");
|
out.println("Nested Exception: ");
|
||||||
cause.printStackTrace(out);
|
wrappedThrowable.printStackTrace(out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,9 +173,9 @@ public class XMPPException extends Exception {
|
||||||
System.err.print(error + " -- ");
|
System.err.print(error + " -- ");
|
||||||
}
|
}
|
||||||
super.printStackTrace(out);
|
super.printStackTrace(out);
|
||||||
if (cause != null) {
|
if (wrappedThrowable != null) {
|
||||||
out.println("Nested Exception: ");
|
out.println("Nested Exception: ");
|
||||||
cause.printStackTrace(out);
|
wrappedThrowable.printStackTrace(out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue