Java Code Examples for java.sql.SQLException#setStackTrace()
The following examples show how to use
java.sql.SQLException#setStackTrace() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: lams File: ServerPreparedStatement.java License: GNU General Public License v2.0 | 5 votes |
private static SQLException appendMessageToException(SQLException sqlEx, String messageToAppend, ExceptionInterceptor interceptor) { String sqlState = sqlEx.getSQLState(); int vendorErrorCode = sqlEx.getErrorCode(); SQLException sqlExceptionWithNewMessage = SQLError.createSQLException(sqlEx.getMessage() + messageToAppend, sqlState, vendorErrorCode, interceptor); sqlExceptionWithNewMessage.setStackTrace(sqlEx.getStackTrace()); return sqlExceptionWithNewMessage; }
Example 2
Source Project: gemfirexd-oss File: ThriftExceptionUtil.java License: Apache License 2.0 | 5 votes |
public static SQLException newSQLException(GFXDException gfxde) { GFXDExceptionData payload = gfxde.getExceptionData(); SQLException sqle = newSQLException(payload, gfxde.getCause(), gfxde.getServerInfo()); // since GFXDException is always a wrapper, no need to record the stack sqle.setStackTrace(gfxde.getStackTrace()); // build next exceptions List<GFXDExceptionData> nextList = gfxde.getNextExceptions(); SQLException current = sqle, next; if (nextList != null) { for (GFXDExceptionData nextData : nextList) { // check for server stack indicator if (SQLState.GFXD_SERVER_STACK_INDICATOR.equals( nextData.getSqlState())) { Throwable cause = sqle; while (cause.getCause() != null) { cause = cause.getCause(); } cause.initCause(new ServerException(nextData.getReason())); } else { next = newSQLException(nextData, null, null); current.setNextException(next); current = next; } } } return sqle; }
Example 3
Source Project: gemfirexd-oss File: Util.java License: Apache License 2.0 | 5 votes |
public static SQLException generateCsSQLException(StandardException se) { // GemStone changes BEGIN // unwrap the StandardException to reduce stack depth (#42595) // also change all StandardExceptions in the chain to SQLException Throwable cause = se.getCause(); DerbyIOException dioe; if (cause instanceof StandardException) { cause = generateCsSQLException((StandardException)cause); } else if (cause instanceof DerbyIOException && (dioe = (DerbyIOException)cause).getSQLState() != null) { cause = exceptionFactory.getSQLException(dioe.getMessage(), dioe.getSQLState(), null, StandardException .getSeverityFromIdentifier(dioe.getSQLState()), cause.getCause(), null); } final SQLException sqle = exceptionFactory.getSQLException( se.getMessage(), se.getMessageId(), null, se.getSeverity(), cause, se.getArguments()); // copy stack from original exception sqle.setStackTrace(se.getStackTrace()); return sqle; /* (original code) return exceptionFactory.getSQLException( se.getMessage(), se.getMessageId(), (SQLException) null, se.getSeverity(), se, se.getArguments()); */ // GemStone changes END }
Example 4
Source Project: FoxTelem File: ServerPreparedStatement.java License: GNU General Public License v3.0 | 5 votes |
private static SQLException appendMessageToException(SQLException sqlEx, String messageToAppend, ExceptionInterceptor interceptor) { String sqlState = sqlEx.getSQLState(); int vendorErrorCode = sqlEx.getErrorCode(); SQLException sqlExceptionWithNewMessage = SQLError.createSQLException(sqlEx.getMessage() + messageToAppend, sqlState, vendorErrorCode, interceptor); sqlExceptionWithNewMessage.setStackTrace(sqlEx.getStackTrace()); return sqlExceptionWithNewMessage; }
Example 5
Source Project: gemfirexd-oss File: ThriftExceptionUtil.java License: Apache License 2.0 | 5 votes |
public static SQLException newSQLException(GFXDException gfxde) { GFXDExceptionData payload = gfxde.getExceptionData(); SQLException sqle = newSQLException(payload, gfxde.getCause(), gfxde.getServerInfo()); // since GFXDException is always a wrapper, no need to record the stack sqle.setStackTrace(gfxde.getStackTrace()); // build next exceptions List<GFXDExceptionData> nextList = gfxde.getNextExceptions(); SQLException current = sqle, next; if (nextList != null) { for (GFXDExceptionData nextData : nextList) { // check for server stack indicator if (SQLState.GFXD_SERVER_STACK_INDICATOR.equals( nextData.getSqlState())) { Throwable cause = sqle; while (cause.getCause() != null) { cause = cause.getCause(); } cause.initCause(new ServerException(nextData.getReason())); } else { next = newSQLException(nextData, null, null); current.setNextException(next); current = next; } } } return sqle; }
Example 6
Source Project: gemfirexd-oss File: Util.java License: Apache License 2.0 | 5 votes |
public static SQLException generateCsSQLException(StandardException se) { // GemStone changes BEGIN // unwrap the StandardException to reduce stack depth (#42595) // also change all StandardExceptions in the chain to SQLException Throwable cause = se.getCause(); DerbyIOException dioe; if (cause instanceof StandardException) { cause = generateCsSQLException((StandardException)cause); } else if (cause instanceof DerbyIOException && (dioe = (DerbyIOException)cause).getSQLState() != null) { cause = exceptionFactory.getSQLException(dioe.getMessage(), dioe.getSQLState(), null, StandardException .getSeverityFromIdentifier(dioe.getSQLState()), cause.getCause(), null); } final SQLException sqle = exceptionFactory.getSQLException( se.getMessage(), se.getMessageId(), null, se.getSeverity(), cause, se.getArguments()); // copy stack from original exception sqle.setStackTrace(se.getStackTrace()); return sqle; /* (original code) return exceptionFactory.getSQLException( se.getMessage(), se.getMessageId(), (SQLException) null, se.getSeverity(), se, se.getArguments()); */ // GemStone changes END }