/** * Rolls up SQL exceptions by taking each proceeding exception * and making it a child of the previous using the <code>setNextException</code> * method of SQLException. */ public static SQLException rollupSqlExceptions(Collection<SQLException> exceptions) { SQLException parent = null; for (SQLException exception : exceptions) { if (parent != null) { exception.setNextException(parent); } parent = exception; } return parent; }
/** * Chains a supplied {@code SQLWarning} to this {@code SQLWarning}. * * @param w * the {@code SQLWarning} linked to this {@code SQLWarning}. */ public void setNextWarning(SQLWarning w) { super.setNextException(w); } }
/** * Obsolete. Appends {@code ex} to the end of this chain. */ public void setNextException(SQLException ex) { if (next != null) { next.setNextException(ex); } else { next = ex; } }
@Override public void handleError(SQLException error) { if (firstException == null) { firstException = lastException = error; return; } lastException.setNextException(error); lastException = error; }
/** * Rolls up SQL exceptions by taking each proceeding exception * and making it a child of the previous using the <code>setNextException</code> * method of SQLException. */ public static SQLException rollupSqlExceptions(final Collection<SQLException> exceptions) { SQLException parent = null; for (SQLException exception : exceptions) { if (parent != null) { exception.setNextException(parent); } parent = exception; } return parent; }
public void handleError(SQLException newError) { if (error == null) error = newError; else error.setNextException(newError); }
public void handleError(SQLException newError) { if (error == null) error = newError; else error.setNextException(newError); }
public void handleError(SQLException newError) { if (error == null) error = newError; else error.setNextException(newError); }
public void handleError(SQLException error) { if (sqle == null) { sqle = error; } else { sqle.setNextException(error); } }
public void handleError(SQLException error) { if (sqle == null) { sqle = error; } else { sqle.setNextException(error); } }
public void handleError(SQLException newError) { if (error == null) error = newError; else error.setNextException(newError); }
private void throwSQLExceptionIfNecessary(final Collection<SQLException> exceptions) throws SQLException { if (exceptions.isEmpty()) { return; } SQLException ex = new SQLException(); for (SQLException each : exceptions) { ex.setNextException(each); } throw ex; }
private void throwSQLExceptionIfNecessary(final Collection<SQLException> exceptions) throws SQLException { if (exceptions.isEmpty()) { return; } SQLException ex = new SQLException(); for (SQLException each : exceptions) { ex.setNextException(each); } throw ex; }
private void throwSQLExceptionIfNecessary(final Collection<SQLException> exceptions) throws SQLException { if (exceptions.isEmpty()) { return; } SQLException ex = new SQLException(); for (SQLException each : exceptions) { ex.setNextException(each); } throw ex; }
private void throwSQLExceptionIfNecessary(final Collection<SQLException> exceptions) throws SQLException { if (exceptions.isEmpty()) { return; } SQLException ex = new SQLException(); for (SQLException each : exceptions) { ex.setNextException(each); } throw ex; } }
private void throwSQLExceptionIfNecessary(final Collection<SQLException> exceptions) throws SQLException { if (exceptions.isEmpty()) { return; } SQLException ex = new SQLException(); for (SQLException each : exceptions) { ex.setNextException(each); } throw ex; }
/** * Closes all assigned result sets and then closes the query. Query becomes closed. */ protected SQLException closeQuery() { SQLException sqlException = closeQueryResultSets(); if (statement != null) { try { statement.close(); } catch (SQLException sex) { if (sqlException == null) { sqlException = sex; } else { sqlException.setNextException(sex); } } statement = null; } query = null; queryState = CLOSED; return sqlException; }
@Test public void log_all_sql_exceptions() { SQLException root = new SQLException("this is root", "123"); SQLException next = new SQLException("this is next", "456"); root.setNextException(next); DatabaseUtils.log(Loggers.get(getClass()), root); assertThat(logTester.logs(LoggerLevel.ERROR)).contains("SQL error: 456. Message: this is next"); }
/** * Send the batch. * * @param batch Batch. */ private void sendBatch(Batch batch) { DmlPageProcessingResult pageRes = processPage(cctx, batch); batch.clear(); updateCnt += pageRes.count(); if (failedKeys == null) failedKeys = new ArrayList<>(); failedKeys.addAll(F.asList(pageRes.errorKeys())); if (pageRes.error() != null) { if (err == null) err = pageRes.error(); else err.setNextException(pageRes.error()); } }
private void rollbackIfRequired(boolean autosave, SQLException e) throws SQLException { if (autosave && getTransactionState() == TransactionState.FAILED && (getAutoSave() == AutoSave.ALWAYS || willHealOnRetry(e))) { try { // ROLLBACK and AUTOSAVE are executed as simple always to overcome "statement no longer exists S_xx" execute(restoreToAutoSave, SimpleQuery.NO_PARAMETERS, new ResultHandlerDelegate(null), 1, 0, QUERY_NO_RESULTS | QUERY_NO_METADATA | QUERY_EXECUTE_AS_SIMPLE); } catch (SQLException e2) { // That's O(N), sorry e.setNextException(e2); } } throw e; }