public static boolean checkConstraintViolationException(ProcessEngineException exception) { List<SQLException> sqlExceptionList = findRelatedSqlExceptions(exception); for (SQLException ex: sqlExceptionList) { if (ex.getMessage().contains("constraint") || ex.getMessage().contains("violat") || ex.getMessage().toLowerCase().contains("duplicate") || ex.getMessage().contains("ORA-00001") || ex.getMessage().contains("SQLCODE=-803, SQLSTATE=23505")) { return true; } } return false; }
public static boolean checkConstraintViolationException(ProcessEngineException exception) { List<SQLException> sqlExceptionList = findRelatedSqlExceptions(exception); for (SQLException ex: sqlExceptionList) { if (ex.getMessage().contains("constraint") || ex.getMessage().contains("violat") || ex.getMessage().toLowerCase().contains("duplicate") || ex.getMessage().contains("ORA-00001") || ex.getMessage().contains("SQLCODE=-803, SQLSTATE=23505")) { return true; } } return false; }
public static boolean checkValueTooLongException(ProcessEngineException exception) { List<SQLException> sqlExceptionList = findRelatedSqlExceptions(exception); for (SQLException ex: sqlExceptionList) { if (ex.getMessage().contains("too long") || ex.getMessage().contains("too large") || ex.getMessage().contains("ORA-01461") || ex.getMessage().contains("ORA-01401") || ex.getMessage().contains("data would be truncated") || ex.getMessage().contains("SQLCODE=-302, SQLSTATE=22001")) { return true; } } return false; }
public static boolean checkValueTooLongException(ProcessEngineException exception) { List<SQLException> sqlExceptionList = findRelatedSqlExceptions(exception); for (SQLException ex: sqlExceptionList) { if (ex.getMessage().contains("too long") || ex.getMessage().contains("too large") || ex.getMessage().contains("ORA-01461") || ex.getMessage().contains("ORA-01401") || ex.getMessage().contains("data would be truncated") || ex.getMessage().contains("SQLCODE=-302, SQLSTATE=22001")) { return true; } } return false; }
public static boolean checkVariableIntegrityViolation(Throwable cause) { List<SQLException> relatedSqlExceptions = findRelatedSqlExceptions(cause); for (SQLException exception : relatedSqlExceptions) { if ( // MySQL & MariaDB (exception.getMessage().toLowerCase().contains("act_uniq_variable") && "23000".equals(exception.getSQLState()) && exception.getErrorCode() == 1062) // PostgreSQL || (exception.getMessage().toLowerCase().contains("act_uniq_variable") && "23505".equals(exception.getSQLState()) && exception.getErrorCode() == 0) // SqlServer || (exception.getMessage().toLowerCase().contains("act_uniq_variable") && "23000".equals(exception.getSQLState()) && exception.getErrorCode() == 2601) // Oracle || (exception.getMessage().toLowerCase().contains("act_uniq_variable") && "23000".equals(exception.getSQLState()) && exception.getErrorCode() == 1) // H2 || (exception.getMessage().toLowerCase().contains("act_uniq_variable_index_c") && "23505".equals(exception.getSQLState()) && exception.getErrorCode() == 23505) ) { return true; } } return false; }
public static boolean checkVariableIntegrityViolation(Throwable cause) { List<SQLException> relatedSqlExceptions = findRelatedSqlExceptions(cause); for (SQLException exception : relatedSqlExceptions) { if ( // MySQL & MariaDB (exception.getMessage().toLowerCase().contains("act_uniq_variable") && "23000".equals(exception.getSQLState()) && exception.getErrorCode() == 1062) // PostgreSQL || (exception.getMessage().toLowerCase().contains("act_uniq_variable") && "23505".equals(exception.getSQLState()) && exception.getErrorCode() == 0) // SqlServer || (exception.getMessage().toLowerCase().contains("act_uniq_variable") && "23000".equals(exception.getSQLState()) && exception.getErrorCode() == 2601) // Oracle || (exception.getMessage().toLowerCase().contains("act_uniq_variable") && "23000".equals(exception.getSQLState()) && exception.getErrorCode() == 1) // H2 || (exception.getMessage().toLowerCase().contains("act_uniq_variable_index_c") && "23505".equals(exception.getSQLState()) && exception.getErrorCode() == 23505) ) { return true; } } return false; }
public static boolean checkForeignKeyConstraintViolation(Throwable cause) { List<SQLException> relatedSqlExceptions = findRelatedSqlExceptions(cause); for (SQLException exception : relatedSqlExceptions) { // PostgreSQL doesn't allow for a proper check if ("23503".equals(exception.getSQLState()) && exception.getErrorCode() == 0) { return false; } else if ( // SqlServer (exception.getMessage().toLowerCase().contains("foreign key constraint") || ("23000".equals(exception.getSQLState()) && exception.getErrorCode() == 547)) // MySql, MariaDB & PostgreSQL || (exception.getMessage().toLowerCase().contains("foreign key constraint") // MySql & MariaDB || ("23000".equals(exception.getSQLState()) && exception.getErrorCode() == 1452)) // Oracle & H2 || (exception.getMessage().toLowerCase().contains("integrity constraint") // Oracle || ("23000".equals(exception.getSQLState()) && exception.getErrorCode() == 2291) // H2 || ("23506".equals(exception.getSQLState()) && exception.getErrorCode() == 23506)) // DB2 || (exception.getMessage().toLowerCase().contains("sqlstate=23503") && exception.getMessage().toLowerCase().contains("sqlcode=-530")) ) { return true; } } return false; }
public static boolean checkForeignKeyConstraintViolation(Throwable cause) { List<SQLException> relatedSqlExceptions = findRelatedSqlExceptions(cause); for (SQLException exception : relatedSqlExceptions) { // PostgreSQL doesn't allow for a proper check if ("23503".equals(exception.getSQLState()) && exception.getErrorCode() == 0) { return false; } else if ( // SqlServer (exception.getMessage().toLowerCase().contains("foreign key constraint") || ("23000".equals(exception.getSQLState()) && exception.getErrorCode() == 547)) // MySql, MariaDB & PostgreSQL || (exception.getMessage().toLowerCase().contains("foreign key constraint") // MySql & MariaDB || ("23000".equals(exception.getSQLState()) && exception.getErrorCode() == 1452)) // Oracle & H2 || (exception.getMessage().toLowerCase().contains("integrity constraint") // Oracle || ("23000".equals(exception.getSQLState()) && exception.getErrorCode() == 2291) // H2 || ("23506".equals(exception.getSQLState()) && exception.getErrorCode() == 23506)) // DB2 || (exception.getMessage().toLowerCase().contains("sqlstate=23503") && exception.getMessage().toLowerCase().contains("sqlcode=-530")) ) { return true; } } return false; }
public ProcessEngineException flushDbOperationsException(List<DbOperation> operationsToFlush, Throwable cause) { String message = cause.getMessage(); //collect real SQL exception messages in case of batch processing Throwable exCause = cause; do { if (exCause instanceof BatchExecutorException) { final List<SQLException> relatedSqlExceptions = ExceptionUtil.findRelatedSqlExceptions(exCause); StringBuilder sb = new StringBuilder(); for (SQLException sqlException : relatedSqlExceptions) { sb.append(sqlException).append("\n"); } message = message + "\n" + sb.toString(); } exCause = exCause.getCause(); } while (exCause != null); String exceptionMessage = exceptionMessage( "083", "Exception while executing Batch Database Operations with message '{}'. Flush summary: \n {}", message, buildStringFromList(operationsToFlush) ); return new ProcessEngineException(exceptionMessage, cause); }
public ProcessEngineException flushDbOperationsException(List<DbOperation> operationsToFlush, Throwable cause) { String message = cause.getMessage(); //collect real SQL exception messages in case of batch processing Throwable exCause = cause; do { if (exCause instanceof BatchExecutorException) { final List<SQLException> relatedSqlExceptions = ExceptionUtil.findRelatedSqlExceptions(exCause); StringBuilder sb = new StringBuilder(); for (SQLException sqlException : relatedSqlExceptions) { sb.append(sqlException).append("\n"); } message = message + "\n" + sb.toString(); } exCause = exCause.getCause(); } while (exCause != null); String exceptionMessage = exceptionMessage( "083", "Exception while executing Batch Database Operations with message '{}'. Flush summary: \n {}", message, buildStringFromList(operationsToFlush) ); return new ProcessEngineException(exceptionMessage, cause); }
public static boolean checkConstraintViolationException(ProcessEngineException exception) { List<SQLException> sqlExceptionList = findRelatedSqlExceptions(exception); for (SQLException ex: sqlExceptionList) { if (ex.getMessage().contains("constraint") || ex.getMessage().contains("violat") || ex.getMessage().toLowerCase().contains("duplicate") || ex.getMessage().contains("ORA-00001") || ex.getMessage().contains("SQLCODE=-803, SQLSTATE=23505")) { return true; } } return false; }
public static boolean checkValueTooLongException(ProcessEngineException exception) { List<SQLException> sqlExceptionList = findRelatedSqlExceptions(exception); for (SQLException ex: sqlExceptionList) { if (ex.getMessage().contains("too long") || ex.getMessage().contains("too large") || ex.getMessage().contains("ORA-01461") || ex.getMessage().contains("ORA-01401") || ex.getMessage().contains("data would be truncated") || ex.getMessage().contains("SQLCODE=-302, SQLSTATE=22001")) { return true; } } return false; }
public static boolean checkVariableIntegrityViolation(Throwable cause) { List<SQLException> relatedSqlExceptions = findRelatedSqlExceptions(cause); for (SQLException exception : relatedSqlExceptions) { if ( // MySQL & MariaDB (exception.getMessage().toLowerCase().contains("act_uniq_variable") && "23000".equals(exception.getSQLState()) && exception.getErrorCode() == 1062) // PostgreSQL || (exception.getMessage().toLowerCase().contains("act_uniq_variable") && "23505".equals(exception.getSQLState()) && exception.getErrorCode() == 0) // SqlServer || (exception.getMessage().toLowerCase().contains("act_uniq_variable") && "23000".equals(exception.getSQLState()) && exception.getErrorCode() == 2601) // Oracle || (exception.getMessage().toLowerCase().contains("act_uniq_variable") && "23000".equals(exception.getSQLState()) && exception.getErrorCode() == 1) // H2 || (exception.getMessage().toLowerCase().contains("act_uniq_variable_index_c") && "23505".equals(exception.getSQLState()) && exception.getErrorCode() == 23505) ) { return true; } } return false; }
public static boolean checkForeignKeyConstraintViolation(Throwable cause) { List<SQLException> relatedSqlExceptions = findRelatedSqlExceptions(cause); for (SQLException exception : relatedSqlExceptions) { // PostgreSQL doesn't allow for a proper check if ("23503".equals(exception.getSQLState()) && exception.getErrorCode() == 0) { return false; } else if ( // SqlServer (exception.getMessage().toLowerCase().contains("foreign key constraint") || ("23000".equals(exception.getSQLState()) && exception.getErrorCode() == 547)) // MySql, MariaDB & PostgreSQL || (exception.getMessage().toLowerCase().contains("foreign key constraint") // MySql & MariaDB || ("23000".equals(exception.getSQLState()) && exception.getErrorCode() == 1452)) // Oracle & H2 || (exception.getMessage().toLowerCase().contains("integrity constraint") // Oracle || ("23000".equals(exception.getSQLState()) && exception.getErrorCode() == 2291) // H2 || ("23506".equals(exception.getSQLState()) && exception.getErrorCode() == 23506)) // DB2 || (exception.getMessage().toLowerCase().contains("sqlstate=23503") && exception.getMessage().toLowerCase().contains("sqlcode=-530")) ) { return true; } } return false; }
public ProcessEngineException flushDbOperationsException(List<DbOperation> operationsToFlush, Throwable cause) { String message = cause.getMessage(); //collect real SQL exception messages in case of batch processing Throwable exCause = cause; do { if (exCause instanceof BatchExecutorException) { final List<SQLException> relatedSqlExceptions = ExceptionUtil.findRelatedSqlExceptions(exCause); StringBuffer sb = new StringBuffer(); for (SQLException sqlException : relatedSqlExceptions) { sb.append(sqlException).append("\n"); } message = message + "\n" + sb.toString(); } exCause = exCause.getCause(); } while (exCause != null); String exceptionMessage = exceptionMessage( "083", "Exception while executing Batch Database Operations with message '{}'. Flush summary: \n {}", message, buildStringFromList(operationsToFlush) ); return new ProcessEngineException(exceptionMessage, cause); }