java.sql.SQLException.getStackTrace()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中java.sql.SQLException.getStackTrace()方法的一些代码示例,展示了SQLException.getStackTrace()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SQLException.getStackTrace()方法的具体详情如下:
包路径:java.sql.SQLException
类名称:SQLException
方法名:getStackTrace

SQLException.getStackTrace介绍

暂无

代码示例

代码示例来源:origin: org.apache.logging.log4j/log4j-core

@SuppressWarnings("unchecked")
final List<Map<String, Object>> stackTrace = (List<Map<String, Object>>) thrown.get("stackTrace");
assertEquals("The thrown stack trace length is not correct.", exception2.getStackTrace().length,
  stackTrace.size());
for (int i = 0; i < exception2.getStackTrace().length; i++) {
  final StackTraceElement e1 = exception2.getStackTrace()[i];
  final Map<String, Object> e2 = stackTrace.get(i);

代码示例来源:origin: forcedotcom/phoenix

@Override
public StackTraceElement[] getStackTrace() {
  if (!this.hasSetStackTrace) {
    ArrayList<StackTraceElement> frames = new ArrayList<StackTraceElement>(this.exceptions.size() * 20);
    
    int exceptionNum = 0;
    for (SQLException exception : this.exceptions) {
      StackTraceElement header = new StackTraceElement(MultipleCausesSQLException.class.getName(), 
          "Exception Number " + exceptionNum, 
          "<no file>",
          0);
      
      frames.add(header);
      for (StackTraceElement ste : exception.getStackTrace()) {
        frames.add(ste);
      }
      exceptionNum++;
    }
    
    setStackTrace(frames.toArray(new StackTraceElement[frames.size()]));
    this.hasSetStackTrace = true;
  }        
  
  return super.getStackTrace();
}

代码示例来源:origin: apache/phoenix

@Override
public StackTraceElement[] getStackTrace() {
  if (!this.hasSetStackTrace) {
    ArrayList<StackTraceElement> frames = new ArrayList<StackTraceElement>(this.exceptions.size() * 20);
    
    int exceptionNum = 0;
    for (SQLException exception : this.exceptions) {
      StackTraceElement header = new StackTraceElement(MultipleCausesSQLException.class.getName(), 
          "Exception Number " + exceptionNum, 
          "<no file>",
          0);
      
      frames.add(header);
      for (StackTraceElement ste : exception.getStackTrace()) {
        frames.add(ste);
      }
      exceptionNum++;
    }
    
    setStackTrace(frames.toArray(new StackTraceElement[frames.size()]));
    this.hasSetStackTrace = true;
  }        
  
  return super.getStackTrace();
}

代码示例来源:origin: palantir/atlasdb

public VerboseSQLException(SQLException exception, String verboseErrorMessage) {
  super(exception.getMessage(), exception.getSQLState(), exception.getErrorCode());
  setNextException(exception.getNextException());
  setStackTrace(exception.getStackTrace());
  if (exception.getCause() != null) {
    initCause(exception.getCause());
  } else if (exception.getNextException() != null) {
    initCause(exception.getNextException());
  }
  this.verboseErrorMessage = verboseErrorMessage;
}

代码示例来源:origin: io.snappydata/gemfirexd-tools

public void handleError(SQLException ex)
  {
    log("Could not read the primary keys for table '" + tableName + "' from the result set: " + ex.getStackTrace(), Project.MSG_ERR);
  }
});

代码示例来源:origin: io.snappydata/gemfirexd-tools

public void handleError(SQLException ex)
  {
    log("Could not determine the foreign keys for table '" + tableName + "': " + ex.getStackTrace(), Project.MSG_ERR);
  }
});

代码示例来源:origin: io.snappydata/gemfirexd-tools

public void handleError(SQLException ex)
  {
    log("Could not read the columns for procedure '"+procedureName+"' from the result set: " + ex.getStackTrace(), Project.MSG_ERR);
  }
});

代码示例来源:origin: io.snappydata/gemfirexd-tools

public void handleError(SQLException ex)
  {
    log("Could not read the catalogs from the result set: " + ex.getStackTrace(), Project.MSG_ERR);
  }
});

代码示例来源:origin: io.snappydata/gemfirexd-tools

public void handleError(SQLException ex)
  {
    log("Could not read the table types from the result set: " + ex.getStackTrace(), Project.MSG_ERR);
  }
});

代码示例来源:origin: io.snappydata/gemfirexd-tools

public void handleError(SQLException ex)
  {
    log("Could not read the colums for table '" + tableName + "' from the result set: "+ex.getStackTrace(), Project.MSG_ERR);
  }
});

代码示例来源:origin: io.snappydata/gemfirexd-tools

public void handleError(SQLException ex)
  {
    log("Could not read the procedures from the result set: " + ex.getStackTrace(), Project.MSG_ERR);
  }
});

代码示例来源:origin: io.snappydata/gemfirexd-tools

public void handleError(SQLException ex)
  {
    log("Could not read the schemas from the result set: " + ex.getStackTrace(), Project.MSG_ERR);
  }
});

代码示例来源:origin: io.snappydata/gemfirexd-tools

public void handleError(SQLException ex)
  {
    log("Could not read the tables from the result set: " + ex.getStackTrace(), Project.MSG_ERR);
  }
});

代码示例来源:origin: io.snappydata/gemfirexd-tools

public void handleError(SQLException ex)
  {
    log("Could not read the versioned columns for table '" + tableName + "' from the result set: " + ex.getStackTrace(), Project.MSG_ERR);
  }
});

代码示例来源:origin: io.snappydata/gemfirexd-tools

public void handleError(SQLException ex)
  {
    log("Could not read the indexes for table '" + tableName + "' from the result set: " + ex.getStackTrace(), Project.MSG_ERR);
  }
});

代码示例来源:origin: JetBrains/dekaf

public StrippedSQLException(@NotNull final SQLException originalException,
              @Nullable final Throwable cause) {
 super(prepareMessage(originalException),
    originalException.getSQLState(),
    originalException.getErrorCode(),
    cause);
 originalClassName = originalException.getClass().getName();
 setStackTrace(originalException.getStackTrace());
}

代码示例来源:origin: org.rhq/rhq-core-dbutils

public ExtendedSQLException(SQLException sqlException, String sql) {
  super(sqlException.getMessage(), sqlException.getSQLState(), sqlException.getErrorCode(), sqlException);
  setNextException(sqlException.getNextException());
  setStackTrace(sqlException.getStackTrace());
  this.sql = sql;
}

代码示例来源:origin: mcMMO-Dev/mcMMO

private void printErrors(SQLException ex) {
  StackTraceElement element = ex.getStackTrace()[0];
  mcMMO.p.getLogger().severe("Location: " + element.getClassName() + " " + element.getMethodName() + " " + element.getLineNumber());
  mcMMO.p.getLogger().severe("SQLException: " + ex.getMessage());
  mcMMO.p.getLogger().severe("SQLState: " + ex.getSQLState());
  mcMMO.p.getLogger().severe("VendorError: " + ex.getErrorCode());
}

代码示例来源:origin: jajja/jorm

public JormSqlException(String database, String sql, SQLException sqlException) {
  super(
      rewriteMessage(sqlException.getMessage(), database, sql),
      sqlException.getSQLState(),
      sqlException.getErrorCode(),
      sqlException.getCause()
      );
  this.database = database;
  this.sql = sql;
  setStackTrace(sqlException.getStackTrace());
}

代码示例来源:origin: com.palantir.atlasdb/commons-api

public VerboseSQLException(SQLException exception, String verboseErrorMessage) {
  super(exception.getMessage(), exception.getSQLState(), exception.getErrorCode());
  setNextException(exception.getNextException());
  setStackTrace(exception.getStackTrace());
  if (exception.getCause() != null) {
    initCause(exception.getCause());
  } else if (exception.getNextException() != null) {
    initCause(exception.getNextException());
  }
  this.verboseErrorMessage = verboseErrorMessage;
}

相关文章