Skip to content

Commit

Permalink
fix(spring): check type before cast to SQLException (camunda#3610)
Browse files Browse the repository at this point in the history
related to camunda#3712
  • Loading branch information
ReDestroyDeR authored Aug 28, 2023
1 parent e573859 commit 1440fb2
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,15 @@ public <T> T execute(final Command<T> command) {
// When CockroachDB is used, a CRDB concurrency error may occur on transaction commit.
// To ensure that these errors are still detected as OLEs, we must catch them and wrap
// them in a CrdbTransactionRetryException
SQLException sqlException = (SQLException) ex.getCause();
if (processEngineConfiguration != null
&& DbSqlSession.isCrdbConcurrencyConflictOnCommit(sqlException, processEngineConfiguration)) {
throw ProcessEngineLogger.PERSISTENCE_LOGGER.crdbTransactionRetryExceptionOnCommit(ex);
Throwable cause = ex.getCause();
if (cause instanceof SQLException && processEngineConfiguration != null
&& DbSqlSession.isCrdbConcurrencyConflictOnCommit((SQLException) cause, processEngineConfiguration)) {
throw ProcessEngineLogger.PERSISTENCE_LOGGER.crdbTransactionRetryExceptionOnCommit(cause);

} else {
throw ex;

}
}
}
}
}

0 comments on commit 1440fb2

Please sign in to comment.