1 5 6 package javax.xml.bind; 7 8 import java.io.PrintWriter ; 9 10 20 public class JAXBException extends Exception { 21 22 26 private String errorCode; 27 28 32 private Throwable linkedException; 33 34 static final long serialVersionUID = -5621384651494307979L; 35 36 42 public JAXBException(String message) { 43 this( message, null, null ); 44 } 45 46 53 public JAXBException(String message, String errorCode) { 54 this( message, errorCode, null ); 55 } 56 57 63 public JAXBException(Throwable exception) { 64 this( null, null, exception ); 65 } 66 67 74 public JAXBException(String message, Throwable exception) { 75 this( message, null, exception ); 76 } 77 78 86 public JAXBException(String message, String errorCode, Throwable exception) { 87 super( message ); 88 this.errorCode = errorCode; 89 this.linkedException = exception; 90 } 91 92 97 public String getErrorCode() { 98 return this.errorCode; 99 } 100 101 106 public Throwable getLinkedException() { 107 return linkedException; 108 } 109 110 117 public synchronized void setLinkedException( Throwable exception ) { 118 this.linkedException = exception; 119 } 120 121 125 public String toString() { 126 return linkedException == null ? 127 super.toString() : 128 super.toString() + "\n - with linked exception:\n[" + 129 linkedException.toString()+ "]"; 130 } 131 132 138 public void printStackTrace( java.io.PrintStream s ) { 139 super.printStackTrace(s); 140 } 141 142 147 public void printStackTrace() { 148 super.printStackTrace(); 149 } 150 151 157 public void printStackTrace(PrintWriter s) { 158 super.printStackTrace(s); 159 } 160 161 @Override 162 public Throwable getCause() { 163 return linkedException; 164 } 165 } 166 | Popular Tags |