java.sql.SQLException#setStackTrace ( )源码实例Demo

下面列出了java.sql.SQLException#setStackTrace ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: lams   文件: ServerPreparedStatement.java
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;
}
 
源代码2 项目: gemfirexd-oss   文件: ThriftExceptionUtil.java
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;
}
 
源代码3 项目: gemfirexd-oss   文件: Util.java
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
    }
 
源代码4 项目: FoxTelem   文件: ServerPreparedStatement.java
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;
}
 
源代码5 项目: gemfirexd-oss   文件: ThriftExceptionUtil.java
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;
}
 
源代码6 项目: gemfirexd-oss   文件: Util.java
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
    }