1 23 24 package org.objectweb.cjdbc.common.exceptions.driver; 25 26 import java.io.PrintStream ; 27 import java.io.PrintWriter ; 28 import java.sql.SQLException ; 29 30 import org.objectweb.cjdbc.common.exceptions.driver.protocol.SerializableException; 31 32 41 46 public class DriverSQLException extends SQLException 47 { 48 51 public DriverSQLException() 52 { 53 super(); 54 } 55 56 59 public DriverSQLException(String reason) 60 { 61 super(reason); 62 } 63 64 67 public DriverSQLException(String reason, String sQLState) 68 { 69 super(reason, sQLState); 70 } 71 72 75 public DriverSQLException(String reason, String sQLState, int vendorCode) 76 { 77 super(reason, sQLState, vendorCode); 78 } 79 80 88 public DriverSQLException(String message, SerializableException cause) 89 { 90 super(message, cause.getSQLState(), cause.getErrorCode()); 91 initCause(cause); 92 } 93 94 99 public DriverSQLException(SerializableException cause) 100 { 101 this("Message of cause: " + cause.getLocalizedMessage(), cause); 102 } 103 104 109 public DriverSQLException(Exception cause) 110 { 111 115 this("Message of cause: " + cause.getLocalizedMessage(), cause); 116 } 117 118 126 public DriverSQLException(String message, Exception cause) 127 { 128 super(message); 129 initCause(cause); 130 } 131 132 136 public DriverSQLException(SQLException cause) 137 { 138 this("", cause); 139 } 140 141 150 public DriverSQLException(String message, SQLException cause) 151 throws IllegalArgumentException 152 { 153 super(message); 155 initCause(cause); 156 157 160 } 167 168 174 public void printStackTrace(PrintStream s) 175 { 176 183 super.printStackTrace(s); 184 185 Throwable cause = getCause(); 187 if (null != cause && cause instanceof SerializableException) 188 { 189 s.println("SerializableStackTrace of each cause:"); 190 ((SerializableException) cause).printStackTrace(s); 191 } 192 } 193 194 200 public void printStackTrace() 201 { 202 207 super.printStackTrace(); 208 209 } 210 211 217 public void printStackTrace(PrintWriter s) 218 { 219 220 super.printStackTrace(s); 221 222 Throwable cause = getCause(); 223 if (null != cause && cause instanceof SerializableException) 224 { 225 s.println("SerializableStackTrace of each cause:"); 226 ((SerializableException) cause).printStackTrace(s); 227 } 228 } 229 230 } 231 | Popular Tags |