KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jcifs > util > transport > TransportException


1 package jcifs.util.transport;
2
3 import java.io.IOException JavaDoc;
4 import java.io.PrintWriter JavaDoc;
5 import java.io.StringWriter JavaDoc;
6
7 public class TransportException extends IOException JavaDoc {
8
9     private Throwable JavaDoc rootCause;
10
11     public TransportException() {
12     }
13     public TransportException( String JavaDoc msg ) {
14         super( msg );
15     }
16     public TransportException( Throwable JavaDoc rootCause ) {
17         this.rootCause = rootCause;
18     }
19     public TransportException( String JavaDoc msg, Throwable JavaDoc rootCause ) {
20         super( msg );
21         this.rootCause = rootCause;
22     }
23
24     public Throwable JavaDoc getRootCause() {
25         return rootCause;
26     }
27     public String JavaDoc toString() {
28         if( rootCause != null ) {
29             StringWriter JavaDoc sw = new StringWriter JavaDoc();
30             PrintWriter JavaDoc pw = new PrintWriter JavaDoc( sw );
31             rootCause.printStackTrace( pw );
32             return super.toString() + "\n" + sw;
33         } else {
34             return super.toString();
35         }
36     }
37 }
38
39
Popular Tags