List of utility methods to do SQLException
void | printSQLExceptionToErrorLog(Log logger, String message, List print SQL Exception To Error Log if (sqlExceptions != null && !sqlExceptions.isEmpty()) { for (SQLException sqlException : sqlExceptions) { logger.error(message, sqlException); sqlExceptions.clear(); |
void | printStackTrace(final Throwable exception) print Stack Trace printStackTrace(exception, null); |
void | printStackTrace(SQLException e) Print the stack trace for a SQLException to STDERR. printStackTrace(e, new PrintWriter(System.err));
|
SQLException | retrieveDetailException(Throwable throwable) Returns an instance of SQLException containing detailed error information
String lineSep = System.getProperty("line.separator"); if (throwable != null) { StringBuffer msg = new StringBuffer(""); if (throwable.getLocalizedMessage() != null) { msg.append(throwable.getLocalizedMessage()); } else { msg.append(throwable.getMessage()); if (throwable instanceof SQLException) { SQLException sqlEx = (SQLException) throwable; while (sqlEx.getNextException() != null) { sqlEx = sqlEx.getNextException(); if (sqlEx.getLocalizedMessage() != null) { msg.append("").append(lineSep).append(sqlEx.getLocalizedMessage()); } else { msg.append("").append(lineSep).append(sqlEx.getMessage()); return new SQLException(msg.toString()); return null; |
void | rollbackTransaction(final Connection conn, final SQLException e) Esegue un rollback della transazione. if (conn != null) { conn.rollback(); logger.fatal("Connection rollback..."); logger.fatal(e.getStackTrace()); StringWriter sWriter = new StringWriter(); e.printStackTrace(new PrintWriter(sWriter)); logger.fatal(sWriter.getBuffer().toString()); |
void | throwException(final Throwable t) Examine a Throwable to preserve RuntimeException and Error, otherwise throw a SQLException. throwException(t, null); |
SQLException | throwException(String message) throw Exception throw new SQLException(message, "FULLTEXT"); |
SQLException | toSQLException(Throwable e) convert Throwable to SQLException SQLException se = new SQLException(e.getMessage()); se.setStackTrace(e.getStackTrace()); se.printStackTrace(); return se; |
SQLException | unboxException(SQLException exception) unbox Exception final Throwable cause = exception.getCause(); if (cause == null || !(cause instanceof RuntimeException)) { return exception; SQLException unboxed = new SQLException(exception.getMessage()); unboxed.setStackTrace(exception.getStackTrace()); return unboxed; |