Package org.camunda.bpm.engine.impl.util
Class ExceptionUtil
java.lang.Object
org.camunda.bpm.engine.impl.util.ExceptionUtil
- Author:
- Roman Smirnov, Askar Akhmerov
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckConstraintViolationException(ProcessEngineException genericPersistenceException) static booleancheckDeadlockException(SQLException sqlException) static booleancheckForeignKeyConstraintViolation(SQLException sqlException) static booleancheckForeignKeyConstraintViolation(org.apache.ibatis.exceptions.PersistenceException persistenceException) static booleancheckValueTooLongException(SQLException sqlException) static booleancheckValueTooLongException(ProcessEngineException genericPersistenceException) static booleancheckVariableIntegrityViolation(org.apache.ibatis.exceptions.PersistenceException persistenceException) static ByteArrayEntitycreateExceptionByteArray(String name, byte[] byteArray, ResourceType type) create ByteArrayEntity with specified name and payload and make sure it's persisted used in Jobs and ExternalTasksstatic ByteArrayEntitycreateJobExceptionByteArray(byte[] byteArray, ResourceType type) static <T> TdoWithExceptionWrapper(Supplier<T> supplier) Pass logic, which directly calls MyBatis API.static org.apache.ibatis.executor.BatchExecutorExceptionfindBatchExecutorException(org.apache.ibatis.exceptions.PersistenceException exception) static StringgetExceptionStacktrace(Throwable exception) static StringgetExceptionStacktrace(ByteArrayEntity byteArray) protected static ThrowablegetPersistenceCauseException(org.apache.ibatis.exceptions.PersistenceException persistenceException) static SQLExceptionunwrapException(org.apache.ibatis.exceptions.PersistenceException persistenceException) static SQLExceptionunwrapException(ProcessEngineException genericPersistenceException)
-
Field Details
-
PERSISTENCE_EXCEPTION_MESSAGE
- See Also:
-
PERSISTENCE_CONNECTION_ERROR_CLASS
- See Also:
-
-
Constructor Details
-
ExceptionUtil
public ExceptionUtil()
-
-
Method Details
-
getExceptionStacktrace
-
getExceptionStacktrace
-
createJobExceptionByteArray
-
createExceptionByteArray
public static ByteArrayEntity createExceptionByteArray(String name, byte[] byteArray, ResourceType type) create ByteArrayEntity with specified name and payload and make sure it's persisted used in Jobs and ExternalTasks- Parameters:
name- - type\source of the exceptionbyteArray- - payload of the exceptiontype- - resource type of the exception- Returns:
- persisted entity
-
getPersistenceCauseException
protected static Throwable getPersistenceCauseException(org.apache.ibatis.exceptions.PersistenceException persistenceException) -
unwrapException
public static SQLException unwrapException(org.apache.ibatis.exceptions.PersistenceException persistenceException) -
unwrapException
-
checkValueTooLongException
-
checkValueTooLongException
public static boolean checkValueTooLongException(ProcessEngineException genericPersistenceException) -
checkConstraintViolationException
public static boolean checkConstraintViolationException(ProcessEngineException genericPersistenceException) -
checkForeignKeyConstraintViolation
public static boolean checkForeignKeyConstraintViolation(org.apache.ibatis.exceptions.PersistenceException persistenceException) -
checkForeignKeyConstraintViolation
-
checkVariableIntegrityViolation
public static boolean checkVariableIntegrityViolation(org.apache.ibatis.exceptions.PersistenceException persistenceException) -
checkDeadlockException
-
findBatchExecutorException
public static org.apache.ibatis.executor.BatchExecutorException findBatchExecutorException(org.apache.ibatis.exceptions.PersistenceException exception) -
doWithExceptionWrapper
Pass logic, which directly calls MyBatis API. In case a MyBatis exception is thrown, it is wrapped into aProcessEngineExceptionand never propagated directly to an Engine API call. In some cases, the top-level exception and its message are shown as a response body in the REST API. Wrapping all MyBatis API calls in our codebase makes sure that the top-level exception is always aProcessEngineExceptionwith a generic message. Like this, SQL details are never disclosed to potential attackers.- Type Parameters:
T- is the type of the return value- Parameters:
supplier- which calls MyBatis API- Returns:
- the value returned by the supplier
- Throws:
ProcessEngineException- which wraps the actual exception
-
wrapPersistenceException
-