1 5 package org.h2.jdbc; 6 7 import java.io.PrintStream ; 8 import java.io.PrintWriter ; 9 import java.sql.SQLException ; 10 11 import org.h2.engine.Constants; 12 13 16 public class JdbcSQLException extends SQLException { 17 18 private static final long serialVersionUID = -8200821788226954151L; 19 private Throwable cause; 20 private String originalMessage; 21 22 29 public JdbcSQLException(String message, String state, int errorCode, Throwable cause) { 30 super(message + " [" + state + "-" + Constants.BUILD_ID + "]", state, errorCode); 31 this.originalMessage = message; 32 this.cause = cause; 33 } 34 35 38 public String getOriginalMessage() { 39 return originalMessage; 40 } 41 42 45 public void printStackTrace() { 46 super.printStackTrace(); 47 if (cause != null) { 48 cause.printStackTrace(); 49 } 50 if(getNextException() != null) { 51 getNextException().printStackTrace(); 52 } 53 } 54 55 60 public void printStackTrace(PrintWriter s) { 61 if(s!=null) { 62 super.printStackTrace(s); 63 if (cause != null) { 64 cause.printStackTrace(s); 65 } 66 if(getNextException() != null) { 67 getNextException().printStackTrace(s); 68 } 69 } 70 } 71 72 77 public void printStackTrace(PrintStream s) { 78 if(s!=null) { 79 super.printStackTrace(s); 80 if (cause != null) { 81 cause.printStackTrace(s); 82 } 83 if(getNextException() != null) { 84 getNextException().printStackTrace(s); 85 } 86 } 87 } 88 89 92 public Throwable getOriginalCause() { 93 return cause; 94 } 95 96 } 97 | Popular Tags |