Package org.camunda.bpm.engine.impl.util
Class ExceptionUtil
- java.lang.Object
-
- org.camunda.bpm.engine.impl.util.ExceptionUtil
-
public class ExceptionUtil extends java.lang.Object
- Author:
- Roman Smirnov, Askar Akhmerov
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PERSISTENCE_EXCEPTION_MESSAGE
-
Constructor Summary
Constructors Constructor Description ExceptionUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
checkConstraintViolationException(ProcessEngineException exception)
static java.lang.Boolean
checkCrdbTransactionRetryException(java.lang.Throwable cause)
static boolean
checkForeignKeyConstraintViolation(java.lang.Throwable cause)
static boolean
checkValueTooLongException(ProcessEngineException exception)
static boolean
checkVariableIntegrityViolation(java.lang.Throwable cause)
static java.lang.String
collectExceptionMessages(java.lang.Throwable cause)
static ByteArrayEntity
createExceptionByteArray(java.lang.String name, byte[] byteArray, ResourceType type)
create ByteArrayEntity with specified name and payload and make sure it's persisted used in Jobs and ExternalTasksstatic ByteArrayEntity
createJobExceptionByteArray(byte[] byteArray, ResourceType type)
static <T> T
doWithExceptionWrapper(java.util.function.Supplier<T> supplier)
Pass logic, which directly calls MyBatis API.static org.apache.ibatis.executor.BatchExecutorException
findBatchExecutorException(java.lang.Throwable exception)
static java.util.List<java.sql.SQLException>
findRelatedSqlExceptions(java.lang.Throwable exception)
static java.lang.String
getExceptionStacktrace(java.lang.Throwable exception)
static java.lang.String
getExceptionStacktrace(ByteArrayEntity byteArray)
static ProcessEngineException
wrapPersistenceException(java.lang.Exception ex)
-
-
-
Field Detail
-
PERSISTENCE_EXCEPTION_MESSAGE
public static final java.lang.String PERSISTENCE_EXCEPTION_MESSAGE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getExceptionStacktrace
public static java.lang.String getExceptionStacktrace(java.lang.Throwable exception)
-
getExceptionStacktrace
public static java.lang.String getExceptionStacktrace(ByteArrayEntity byteArray)
-
createJobExceptionByteArray
public static ByteArrayEntity createJobExceptionByteArray(byte[] byteArray, ResourceType type)
-
createExceptionByteArray
public static ByteArrayEntity createExceptionByteArray(java.lang.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
-
checkValueTooLongException
public static boolean checkValueTooLongException(ProcessEngineException exception)
-
checkConstraintViolationException
public static boolean checkConstraintViolationException(ProcessEngineException exception)
-
findRelatedSqlExceptions
public static java.util.List<java.sql.SQLException> findRelatedSqlExceptions(java.lang.Throwable exception)
-
checkForeignKeyConstraintViolation
public static boolean checkForeignKeyConstraintViolation(java.lang.Throwable cause)
-
checkVariableIntegrityViolation
public static boolean checkVariableIntegrityViolation(java.lang.Throwable cause)
-
checkCrdbTransactionRetryException
public static java.lang.Boolean checkCrdbTransactionRetryException(java.lang.Throwable cause)
-
findBatchExecutorException
public static org.apache.ibatis.executor.BatchExecutorException findBatchExecutorException(java.lang.Throwable exception)
-
collectExceptionMessages
public static java.lang.String collectExceptionMessages(java.lang.Throwable cause)
-
doWithExceptionWrapper
public static <T> T doWithExceptionWrapper(java.util.function.Supplier<T> supplier)
Pass logic, which directly calls MyBatis API. In case a MyBatis exception is thrown, it is wrapped into aProcessEngineException
and 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 aProcessEngineException
with 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
public static ProcessEngineException wrapPersistenceException(java.lang.Exception ex)
-
-