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