List of utility methods to do SQLException
List | appendToExceptionList(List append To Exception List if (list == null) { list = new LinkedList<SQLException>(); list.add(sqlException); return list; |
String | convertSQLExceptionToString(SQLException e) convert SQL Exception To String StringBuilder result = new StringBuilder(e.toString()); if (e.getNextException() != null) { result.append(" - causes:"); SQLException cause = e; while ((cause = cause.getNextException()) != null) { result.append("\n\t").append(e); return result.toString(); |
SQLException | createFeatureNotSupportedException() create Feature Not Supported Exception StackTraceElement ste = new Exception().getStackTrace()[1]; String methodName = ste.getMethodName(); return new SQLFeatureNotSupportedException(methodName + " is not supported"); |
String | exceptionMsg2LocalizedStr(final Throwable e) exception Msg Localized Str if (e == null) return null; String message = e.getLocalizedMessage(); if (message == null) message = e.getClass().getName(); if (e instanceof SQLException) { SQLException nextException = ((SQLException) e).getNextException(); if (nextException != null) ... |
String | exceptionMsg2str(final Throwable e) exception Msgstr if (e == null) return null; String message = e.getMessage(); if (message == null) message = e.getClass().getName(); if (e instanceof SQLException) { SQLException nextException = ((SQLException) e).getNextException(); if (nextException != null) ... |
String | exceptionToString(Throwable e) exception To String StringWriter writer = new StringWriter(); e.printStackTrace(new java.io.PrintWriter(writer)); return writer.toString().replace("" + (char) 0x00, ""); |
int | extractErrorCode(SQLException sqlException) For the given SQLException, locates the vendor-specific error code. int errorCode = sqlException.getErrorCode(); SQLException nested = sqlException.getNextException(); while (errorCode == 0 && nested != null) { errorCode = nested.getErrorCode(); nested = nested.getNextException(); return errorCode; |
List | extractNestedSQLExceptions(SQLException exception) extract Nested SQL Exceptions List<Throwable> throwables = new ArrayList<Throwable>(); while (exception.getNextException() != null) { exception = exception.getNextException(); throwables.add(exception); return throwables; |
String | extractSqlStateClassCode(SQLException sqlException) For the given SQLException, locates the X/Open-compliant SQLState's class code. return determineSqlStateClassCode(extractSqlState(sqlException));
|
String | getAllMessages(Throwable t, boolean includeExceptionName) Returns all the messages for the throwable and all of its causes in one long string. StringBuffer ret_message = new StringBuffer(); if (t != null) { String[] msgs = getAllMessagesArray(t, includeExceptionName); ret_message.append(msgs[0]); for (int i = 1; i < msgs.length; i++) { ret_message.append(ARROW); ret_message.append(msgs[i]); } else { ret_message.append(EXCEPTION_WAS_NULL); return ret_message.toString(); |