Class ExceptionUtil


  • public class ExceptionUtil
    extends Object
    Author:
    Roman Smirnov, Askar Akhmerov
    • Constructor Detail

      • ExceptionUtil

        public ExceptionUtil()
    • Method Detail

      • getExceptionStacktrace

        public static String getExceptionStacktrace​(Throwable exception)
      • 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 exception
        byteArray - - payload of the exception
        type - - resource type of the exception
        Returns:
        persisted entity
      • checkValueTooLongException

        public static boolean checkValueTooLongException​(ProcessEngineException exception)
      • checkConstraintViolationException

        public static boolean checkConstraintViolationException​(ProcessEngineException exception)
      • checkForeignKeyConstraintViolation

        public static boolean checkForeignKeyConstraintViolation​(Throwable cause)
      • checkVariableIntegrityViolation

        public static boolean checkVariableIntegrityViolation​(Throwable cause)
      • checkCrdbTransactionRetryException

        public static Boolean checkCrdbTransactionRetryException​(Throwable cause)
      • findBatchExecutorException

        public static org.apache.ibatis.executor.BatchExecutorException findBatchExecutorException​(Throwable exception)
      • collectExceptionMessages

        public static String collectExceptionMessages​(Throwable cause)
      • doWithExceptionWrapper

        public static <T> T doWithExceptionWrapper​(Supplier<T> supplier)
        Pass logic, which directly calls MyBatis API. In case a MyBatis exception is thrown, it is wrapped into a ProcessEngineException 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 a ProcessEngineException 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