snichol 2002/10/18 13:27:18 Modified: java/src/org/apache/soap SOAPException.java Log: Override printStackTrace methods so that the trace for the targetException is also printed automatically. Revision Changes Path 1.6 +39 -1 xml-soap/java/src/org/apache/soap/SOAPException.java Index: SOAPException.java =================================================================== RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/SOAPException.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- SOAPException.java 18 Oct 2002 13:52:30 -0000 1.5 +++ SOAPException.java 18 Oct 2002 20:27:18 -0000 1.6 @@ -57,6 +57,9 @@ package org.apache.soap; +import java.io.PrintStream; +import java.io.PrintWriter; + /** * <em>SOAP</em> Exceptions. * @@ -96,7 +99,7 @@ } public Throwable getRootException() { - return targetException != null ? targetException : this; + return targetException != null ? targetException : this; } public String getMessage () { @@ -116,6 +119,41 @@ } return msg; + } + + /** + * Prints the stack trace of the thrown target exception. + */ + public void printStackTrace() { + printStackTrace(System.err); + } + + /** + * Prints the stack trace of the thrown target exception to the specified + * print stream. + */ + public void printStackTrace(PrintStream ps) { + synchronized (ps) { + super.printStackTrace(ps); + if (targetException != null) { + ps.print("Caused by: "); + targetException.printStackTrace(ps); + } + } + } + + /** + * Prints the stack trace of the thrown target exception to the + * specified print writer. + */ + public void printStackTrace(PrintWriter pw) { + synchronized (pw) { + super.printStackTrace(pw); + if (targetException != null) { + pw.print("Caused by: "); + targetException.printStackTrace(pw); + } + } } public String toString () {
-- To unsubscribe, e-mail: <mailto:soap-dev-unsubscribe@;xml.apache.org> For additional commands, e-mail: <mailto:soap-dev-help@;xml.apache.org>