1 21 22 package org.continuent.sequoia.common.exceptions.driver; 23 24 import java.io.PrintStream ; 25 import java.io.PrintWriter ; 26 import java.sql.SQLException ; 27 28 import org.continuent.sequoia.common.exceptions.driver.protocol.SerializableException; 29 30 34 public class DriverIOException extends SQLException 35 { 36 private static final long serialVersionUID = 5066115114622251828L; 37 38 41 public DriverIOException() 42 { 43 super(); 44 } 45 46 49 public DriverIOException(String reason) 50 { 51 super(reason); 52 } 53 54 57 public DriverIOException(String reason, String sQLState) 58 { 59 super(reason, sQLState); 60 } 61 62 65 public DriverIOException(String reason, String sQLState, int vendorCode) 66 { 67 super(reason, sQLState, vendorCode); 68 } 69 70 78 public DriverIOException(String message, SerializableException cause) 79 { 80 super(message, cause.getSQLState(), cause.getErrorCode()); 81 initCause(cause); 82 } 83 84 89 public DriverIOException(SerializableException cause) 90 { 91 this("Message of cause: " + cause.getLocalizedMessage(), cause); 92 } 93 94 99 public DriverIOException(Exception cause) 100 { 101 105 this("Message of cause: " + cause.getLocalizedMessage(), cause); 106 } 107 108 116 public DriverIOException(String message, Exception cause) 117 { 118 super(message); 119 initCause(cause); 120 } 121 122 126 public DriverIOException(SQLException cause) 127 { 128 this("", cause); 129 } 130 131 140 public DriverIOException(String message, SQLException cause) 141 throws IllegalArgumentException 142 { 143 super(message); 145 initCause(cause); 146 147 150 } 157 158 164 public void printStackTrace(PrintStream s) 165 { 166 173 super.printStackTrace(s); 174 175 Throwable cause = getCause(); 177 if (null != cause && cause instanceof SerializableException) 178 { 179 s.println("SerializableStackTrace of each cause:"); 180 ((SerializableException) cause).printStackTrace(s); 181 } 182 } 183 184 190 public void printStackTrace() 191 { 192 197 super.printStackTrace(); 198 199 } 200 201 207 public void printStackTrace(PrintWriter s) 208 { 209 210 super.printStackTrace(s); 211 212 Throwable cause = getCause(); 213 if (null != cause && cause instanceof SerializableException) 214 { 215 s.println("SerializableStackTrace of each cause:"); 216 ((SerializableException) cause).printStackTrace(s); 217 } 218 } 219 220 } 221 | Popular Tags |