From cd50dac444585f09e6d077a175a27bca2ee51636 Mon Sep 17 00:00:00 2001 From: Filip Hrisafov Date: Tue, 28 Nov 2023 17:34:11 +0100 Subject: [PATCH] More descriptive error messages * Add / Extend toString to some entities * Use full entities in message for FlowableException * Log non HTTP 500 exceptions under debug in BaseExceptionHandlerAdvice * Include request method and URI in log in BaseExceptionHandlerAdvice --- .../deployer/AppResourceConverterImpl.java | 2 +- .../impl/cmmn/DefaultCaseInstanceService.java | 4 +- .../org/flowable/cmmn/test/CaseTaskTest.java | 3 +- .../test/ExternalWorkerCombinedScopeTest.java | 16 +++--- .../flowable/cmmn/test/ProcessTaskTest.java | 3 +- ...cLeaveActivePlanItemInstanceOperation.java | 2 +- .../StartPlanItemInstanceOperation.java | 2 +- .../TriggerPlanItemInstanceOperation.java | 2 +- .../impl/CasePageTaskActivityBehaviour.java | 2 +- .../impl/CaseTaskActivityBehavior.java | 4 +- .../impl/DecisionTaskActivityBehavior.java | 12 ++--- ...egistryEventListenerActivityBehaviour.java | 2 +- .../ExternalWorkerTaskActivityBehavior.java | 4 +- .../impl/HumanTaskActivityBehavior.java | 2 +- .../impl/ProcessTaskActivityBehavior.java | 8 +-- .../impl/ScriptTaskActivityBehavior.java | 2 +- .../impl/SendEventActivityBehavior.java | 10 ++-- .../TimerEventListenerActivityBehaviour.java | 2 +- .../http/DefaultCmmnHttpActivityDelegate.java | 3 +- .../cmd/AbstractExternalWorkerJobCmd.java | 3 +- .../cmmn/engine/impl/cmd/ClaimTaskCmd.java | 4 +- .../cmmn/engine/impl/cmd/CompleteTaskCmd.java | 4 +- .../impl/cmd/CompleteTaskWithFormCmd.java | 8 +-- .../cmmn/engine/impl/cmd/DelegateTaskCmd.java | 4 +- .../cmd/DeleteHistoricCaseInstanceCmd.java | 2 +- .../cmd/DeleteHistoricTaskInstanceCmd.java | 2 +- .../engine/impl/cmd/GetStageOverviewCmd.java | 2 +- .../engine/impl/cmd/NeedsActiveTaskCmd.java | 6 +-- .../impl/cmd/RemoveTaskVariablesCmd.java | 4 +- .../cmmn/engine/impl/cmd/ResolveTaskCmd.java | 4 +- .../engine/impl/cmd/SetTaskVariablesCmd.java | 4 +- .../engine/impl/cmd/StartProgressTaskCmd.java | 4 +- .../cmmn/engine/impl/cmd/SuspendTaskCmd.java | 4 +- .../history/DefaultCmmnHistoryManager.java | 2 +- ...LeaveActivePlanItemInstanceJobHandler.java | 2 +- .../entity/CaseInstanceEntityImpl.java | 13 +++++ .../HistoricCaseInstanceEntityImpl.java | 13 +++++ .../HistoricPlanItemInstanceEntityImpl.java | 26 ++++++++++ .../entity/PlanItemInstanceEntityImpl.java | 14 +++++ .../MybatisCaseDefinitionDataManager.java | 4 +- .../cmmn/engine/impl/task/TaskHelper.java | 6 +-- .../cmmn/engine/impl/util/ExpressionUtil.java | 2 +- .../util/PlanItemInstanceContainerUtil.java | 2 +- .../ExternalWorkerServiceTaskTest.java | 6 ++- .../test/logging/ServiceTaskLoggingTest.java | 5 +- .../migration/CaseInstanceMigrationTest.java | 36 ++++++++++--- .../cmmn/test/runtime/ServiceTaskTest.java | 8 ++- .../exception/BaseExceptionHandlerAdvice.java | 52 ++++++++++++++----- .../impl/el/ELExecutionContextBuilder.java | 34 ++++++------ .../common/engine/impl/el/FixedValue.java | 2 +- .../common/engine/impl/el/JuelExpression.java | 8 +-- .../CommandContextInterceptor.java | 2 +- .../impl/scripting/DefaultScriptTrace.java | 11 ++++ .../impl/scripting/ScriptEngineRequest.java | 11 ++++ .../impl/scripting/ScriptingEngines.java | 4 +- .../engine/delegate/DelegateHelper.java | 4 +- .../impl/agenda/ContinueProcessOperation.java | 4 +- .../impl/agenda/DestroyScopeOperation.java | 2 +- .../TakeOutgoingSequenceFlowsOperation.java | 4 +- .../agenda/TriggerExecutionOperation.java | 6 +-- .../AdhocSubProcessActivityBehavior.java | 4 +- .../BoundaryCancelEventActivityBehavior.java | 2 +- ...undaryCompensateEventActivityBehavior.java | 8 +-- .../BoundaryEventActivityBehavior.java | 4 +- ...aryEventRegistryEventActivityBehavior.java | 2 +- .../BoundaryTimerEventActivityBehavior.java | 2 +- .../bpmn/behavior/CallActivityBehavior.java | 4 +- .../CancelEndEventActivityBehavior.java | 6 +-- .../behavior/CaseTaskActivityBehavior.java | 2 +- .../bpmn/behavior/DmnActivityBehavior.java | 8 +-- .../ExclusiveGatewayActivityBehavior.java | 2 +- .../ExternalWorkerTaskActivityBehavior.java | 2 +- .../behavior/FlowNodeActivityBehavior.java | 2 +- ...tchEventRegistryEventActivityBehavior.java | 2 +- ...hrowCompensationEventActivityBehavior.java | 2 +- .../ParallelGatewayActivityBehavior.java | 4 +- .../ReceiveEventTaskActivityBehavior.java | 2 +- .../behavior/ScriptTaskActivityBehavior.java | 5 +- .../SendEventTaskActivityBehavior.java | 4 +- .../SequentialMultiInstanceBehavior.java | 2 +- .../bpmn/behavior/ShellActivityBehavior.java | 2 +- .../behavior/SubProcessActivityBehavior.java | 6 ++- .../behavior/UserTaskActivityBehavior.java | 2 +- .../behavior/WebServiceActivityBehavior.java | 2 +- .../deployer/EventSubscriptionManager.java | 2 +- .../impl/bpmn/helper/ClassDelegate.java | 6 +-- .../impl/bpmn/helper/ErrorPropagation.java | 2 +- .../helper/ErrorThrowingEventListener.java | 4 +- .../bpmn/helper/EscalationPropagation.java | 8 ++- .../http/DefaultBpmnHttpActivityDelegate.java | 2 +- .../impl/cfg/DefaultInternalJobManager.java | 2 +- .../cmd/AbstractExternalWorkerJobCmd.java | 3 +- .../AbstractSetProcessDefinitionStateCmd.java | 2 +- .../AbstractSetProcessInstanceStateCmd.java | 2 +- .../engine/impl/cmd/ActivateTaskCmd.java | 4 +- .../engine/impl/cmd/AddCommentCmd.java | 12 +---- .../cmd/AddMultiInstanceExecutionCmd.java | 4 +- .../engine/impl/cmd/ClaimTaskCmd.java | 4 +- .../impl/cmd/CompleteAdhocSubProcessCmd.java | 4 +- .../engine/impl/cmd/CompleteTaskCmd.java | 6 +-- .../impl/cmd/CompleteTaskWithFormCmd.java | 6 +-- .../engine/impl/cmd/CreateAttachmentCmd.java | 4 +- .../engine/impl/cmd/DelegateTaskCmd.java | 4 +- .../cmd/DeleteHistoricProcessInstanceCmd.java | 2 +- .../cmd/DeleteHistoricTaskInstanceCmd.java | 2 +- .../cmd/DeleteMultiInstanceExecutionCmd.java | 6 +-- .../engine/impl/cmd/DispatchEventCommand.java | 2 +- .../cmd/EvaluateConditionalEventsCmd.java | 6 +-- .../ExecuteActivityForAdhocSubProcessCmd.java | 6 +-- ...nabledActivitiesForAdhocSubProcessCmd.java | 2 +- .../engine/impl/cmd/GetStartFormCmd.java | 2 +- .../engine/impl/cmd/GetTaskFormCmd.java | 2 +- ...mbeddedSubProcessInProcessInstanceCmd.java | 2 +- .../impl/cmd/InjectParallelUserTaskCmd.java | 2 +- .../flowable/engine/impl/cmd/JobRetryCmd.java | 2 +- .../impl/cmd/MessageEventReceivedCmd.java | 6 ++- .../impl/cmd/NeedsActiveExecutionCmd.java | 6 +-- .../engine/impl/cmd/NeedsActiveTaskCmd.java | 8 +-- .../impl/cmd/RemoveExecutionVariablesCmd.java | 4 +- .../impl/cmd/RemoveTaskVariablesCmd.java | 4 +- .../engine/impl/cmd/ResolveTaskCmd.java | 4 +- .../impl/cmd/SetExecutionVariablesCmd.java | 4 +- .../engine/impl/cmd/SetTaskVariablesCmd.java | 4 +- .../impl/cmd/SignalEventReceivedCmd.java | 4 +- .../engine/impl/cmd/StartProgressTaskCmd.java | 4 +- .../engine/impl/cmd/SubmitTaskFormCmd.java | 4 +- .../engine/impl/cmd/SuspendTaskCmd.java | 4 +- .../engine/impl/cmd/TriggerCaseTaskCmd.java | 6 +-- .../flowable/engine/impl/cmd/TriggerCmd.java | 4 +- .../impl/el/UelExpressionCondition.java | 4 +- .../impl/event/AbstractEventHandler.java | 2 +- .../impl/event/CompensationEventHandler.java | 4 +- .../engine/impl/event/SignalEventHandler.java | 6 +-- .../jobexecutor/AsyncLeaveJobHandler.java | 2 +- .../jobexecutor/AsyncSendEventJobHandler.java | 6 +-- ...TimerActivateProcessDefinitionHandler.java | 2 +- .../TimerStartEventJobHandler.java | 12 ++--- .../TimerSuspendProcessDefinitionHandler.java | 2 +- .../entity/ActivityInstanceEntityImpl.java | 17 +++++- .../entity/ExecutionEntityImpl.java | 20 ++++--- .../entity/ExecutionEntityManagerImpl.java | 2 +- .../HistoricDetailEntityManagerImpl.java | 2 +- .../HistoricProcessInstanceEntityImpl.java | 19 ++++++- .../MybatisProcessDefinitionDataManager.java | 2 +- .../impl/scripting/ScriptCondition.java | 4 +- .../impl/util/EventSubscriptionUtil.java | 4 +- .../flowable/engine/impl/util/TaskHelper.java | 8 +-- .../flowable/engine/impl/util/TimerUtil.java | 8 ++- .../api/mgmt/ExternalWorkerJobQueryTest.java | 8 ++- .../test/api/mgmt/ManagementServiceTest.java | 6 ++- .../runtime/ProcessInstanceCommentTest.java | 2 +- .../ProcessInstanceSuspensionTest.java | 29 ++++++----- .../ProcessInstanceMigrationGatewaysTest.java | 3 +- .../test/api/task/TaskIdentityLinksTest.java | 12 +++-- .../engine/test/api/task/TaskServiceTest.java | 17 +++--- .../CallActivityWithElementType.java | 3 +- .../BoundaryEscalationEventTest.java | 15 ++++-- .../event/timer/BoundaryTimerEventTest.java | 6 ++- .../bpmn/gateway/ExclusiveGatewayTest.java | 3 +- .../test/bpmn/mail/EmailSendTaskTest.java | 6 ++- .../test/bpmn/mail/EmailServiceTaskTest.java | 6 ++- .../MultiInstanceVariableAggregationTest.java | 3 +- .../bpmn/scripttask/ScriptTaskTest.java | 7 ++- .../standalone/history/FullHistoryTest.java | 3 +- .../impl/DefaultOutboundEventProcessor.java | 2 +- .../XpathBasedInboundEventKeyDetector.java | 2 +- .../MybatisChannelDefinitionDataManager.java | 2 +- .../MybatisEventDefinitionDataManager.java | 2 +- .../InboundChannelModelProcessor.java | 6 +-- .../impl/runtime/EventInstanceImpl.java | 12 +++++ .../EventPayloadToJsonStringSerializer.java | 2 +- .../EventPayloadToXmlStringSerializer.java | 2 +- .../XpathBasedInboundEventTenantDetector.java | 2 +- .../entity/EventSubscriptionEntityImpl.java | 38 ++++++++++++++ .../common/impl/BaseHttpActivityDelegate.java | 2 +- .../HttpServiceTaskValidationTest.java | 3 +- .../HistoricIdentityLinkEntityImpl.java | 30 +++++++++++ .../impl/asyncexecutor/DefaultJobManager.java | 14 ++--- .../asyncexecutor/ExecuteAsyncRunnable.java | 2 +- .../job/service/impl/cmd/DeleteJobCmd.java | 2 +- .../service/impl/cmd/DeleteTimerJobCmd.java | 2 +- .../impl/cmd/ExecuteHistoryJobCmd.java | 2 +- .../cmd/UnacquireExternalWorkerJobCmd.java | 2 +- .../entity/AbstractJobEntityImpl.java | 42 ++++++++++++++- .../entity/DeadLetterJobEntityImpl.java | 4 -- .../entity/ExternalWorkerJobEntityImpl.java | 5 -- .../entity/HistoryJobEntityImpl.java | 14 ++++- .../persistence/entity/JobEntityImpl.java | 5 -- .../entity/SuspendedJobEntityImpl.java | 5 -- .../entity/TimerJobEntityImpl.java | 5 -- .../common/impl/BaseMailActivityDelegate.java | 18 +++---- .../HistoricTaskInstanceEntityImpl.java | 16 +++++- .../persistence/entity/TaskEntityImpl.java | 21 ++++++-- .../entity/VariableInstanceEntityImpl.java | 21 ++++++++ .../persistence/entity/VariableScopeImpl.java | 4 +- 195 files changed, 808 insertions(+), 423 deletions(-) diff --git a/modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/deployer/AppResourceConverterImpl.java b/modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/deployer/AppResourceConverterImpl.java index 67a4578be9b..f04c4a2bf44 100644 --- a/modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/deployer/AppResourceConverterImpl.java +++ b/modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/deployer/AppResourceConverterImpl.java @@ -40,7 +40,7 @@ public String convertAppModelToJson(AppModel appModel) { try { return objectMapper.writeValueAsString(appModel); } catch (Exception e) { - throw new FlowableException("Error writing app model to json", e); + throw new FlowableException("Error writing app model " + appModel.getKey() + " to json", e); } } } diff --git a/modules/flowable-cmmn-engine-configurator/src/main/java/org/flowable/cmmn/engine/configurator/impl/cmmn/DefaultCaseInstanceService.java b/modules/flowable-cmmn-engine-configurator/src/main/java/org/flowable/cmmn/engine/configurator/impl/cmmn/DefaultCaseInstanceService.java index 793ef808eb3..cc4b3ae927a 100644 --- a/modules/flowable-cmmn-engine-configurator/src/main/java/org/flowable/cmmn/engine/configurator/impl/cmmn/DefaultCaseInstanceService.java +++ b/modules/flowable-cmmn-engine-configurator/src/main/java/org/flowable/cmmn/engine/configurator/impl/cmmn/DefaultCaseInstanceService.java @@ -98,7 +98,7 @@ public String startCaseInstanceByKey(String caseDefinitionKey, String predefined @Override public void handleSignalEvent(EventSubscriptionEntity eventSubscription, Map variables) { if (StringUtils.isEmpty(eventSubscription.getSubScopeId())) { - throw new FlowableException("Plan item instance for event subscription can not be found with empty sub scope id value"); + throw new FlowableException("Plan item instance for " + eventSubscription + " can not be found with empty sub scope id value"); } CmmnRuntimeService cmmnRuntimeService = cmmnEngineConfiguration.getCmmnRuntimeService(); @@ -107,7 +107,7 @@ public void handleSignalEvent(EventSubscriptionEntity eventSubscription, Map processEngineTaskService.deleteTask(caseTasks.get(0).getId())) .isExactlyInstanceOf(FlowableException.class) - .hasMessageContaining("The task cannot be deleted") + .hasMessageContaining("The Task[") + .hasMessageContaining("cannot be deleted") .hasMessageContaining("running case"); cmmnTaskService.complete(caseTasks.get(0).getId()); diff --git a/modules/flowable-cmmn-engine-configurator/src/test/java/org/flowable/cmmn/test/ExternalWorkerCombinedScopeTest.java b/modules/flowable-cmmn-engine-configurator/src/test/java/org/flowable/cmmn/test/ExternalWorkerCombinedScopeTest.java index 43754b68daa..ba16186e527 100644 --- a/modules/flowable-cmmn-engine-configurator/src/test/java/org/flowable/cmmn/test/ExternalWorkerCombinedScopeTest.java +++ b/modules/flowable-cmmn-engine-configurator/src/test/java/org/flowable/cmmn/test/ExternalWorkerCombinedScopeTest.java @@ -67,14 +67,14 @@ public void testSimpleCombined() { assertThatThrownBy(() -> processEngineManagementService.createExternalWorkerCompletionBuilder(cmmnAcquiredJob.getId(), "cmmnWorker").complete()) .isExactlyInstanceOf(FlowableException.class) - .hasMessage("External worker job with id " + cmmnAcquiredJob.getId() - + " is not bpmn scoped. This command can only handle bpmn scoped external worker jobs"); + .hasMessageContaining("ExternalWorkerJobEntity[id=" + cmmnAcquiredJob.getId()) + .hasMessageContaining("is not bpmn scoped. This command can only handle bpmn scoped external worker jobs"); assertThatThrownBy( () -> processEngineManagementService.createExternalWorkerCompletionBuilder(cmmnAcquiredJob.getId(), "cmmnWorker").bpmnError("errorCode")) .isExactlyInstanceOf(FlowableException.class) - .hasMessage("External worker job with id " + cmmnAcquiredJob.getId() - + " is not bpmn scoped. This command can only handle bpmn scoped external worker jobs"); + .hasMessageContaining("ExternalWorkerJobEntity[id=" + cmmnAcquiredJob.getId()) + .hasMessageContaining("is not bpmn scoped. This command can only handle bpmn scoped external worker jobs"); cmmnManagementService.createCmmnExternalWorkerTransitionBuilder(cmmnAcquiredJob.getId(), "cmmnWorker").complete(); @@ -91,13 +91,13 @@ public void testSimpleCombined() { assertThatThrownBy(() -> cmmnManagementService.createCmmnExternalWorkerTransitionBuilder(bpmnAcquiredJob.getId(), "bpmnWorker").complete()) .isExactlyInstanceOf(FlowableException.class) - .hasMessage("External worker job with id " + bpmnAcquiredJob.getId() - + " is not cmmn scoped. This command can only handle cmmn scoped external worker jobs"); + .hasMessageContaining("ExternalWorkerJobEntity[id=" + bpmnAcquiredJob.getId()) + .hasMessageContaining("is not cmmn scoped. This command can only handle cmmn scoped external worker jobs"); assertThatThrownBy(() -> cmmnManagementService.createCmmnExternalWorkerTransitionBuilder(bpmnAcquiredJob.getId(), "bpmnWorker").terminate()) .isExactlyInstanceOf(FlowableException.class) - .hasMessage("External worker job with id " + bpmnAcquiredJob.getId() - + " is not cmmn scoped. This command can only handle cmmn scoped external worker jobs"); + .hasMessageContaining("ExternalWorkerJobEntity[id=" + bpmnAcquiredJob.getId()) + .hasMessageContaining("is not cmmn scoped. This command can only handle cmmn scoped external worker jobs"); processEngineManagementService.createExternalWorkerCompletionBuilder(bpmnAcquiredJob.getId(), "bpmnWorker").complete(); diff --git a/modules/flowable-cmmn-engine-configurator/src/test/java/org/flowable/cmmn/test/ProcessTaskTest.java b/modules/flowable-cmmn-engine-configurator/src/test/java/org/flowable/cmmn/test/ProcessTaskTest.java index bf3c5b9dff8..f0409b5aa74 100644 --- a/modules/flowable-cmmn-engine-configurator/src/test/java/org/flowable/cmmn/test/ProcessTaskTest.java +++ b/modules/flowable-cmmn-engine-configurator/src/test/java/org/flowable/cmmn/test/ProcessTaskTest.java @@ -1372,7 +1372,8 @@ public void testDeleteProcessTaskShouldNotBePossible() { assertThatThrownBy(() -> cmmnTaskService.deleteTask(task.getId())) .isExactlyInstanceOf(FlowableException.class) - .hasMessageContaining("The task cannot be deleted") + .hasMessageContaining("The Task[") + .hasMessageContaining("cannot be deleted") .hasMessageContaining("running process"); } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/agenda/operation/AsyncLeaveActivePlanItemInstanceOperation.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/agenda/operation/AsyncLeaveActivePlanItemInstanceOperation.java index e11e6c5cc63..96ee0bd1b43 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/agenda/operation/AsyncLeaveActivePlanItemInstanceOperation.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/agenda/operation/AsyncLeaveActivePlanItemInstanceOperation.java @@ -59,7 +59,7 @@ protected void internalExecute() { if (planItemDefinition instanceof Task) { createAsyncJob((Task) planItemDefinition); } else { - throw new FlowableException("Programmatic error: this operation can only be planned for Task plan item definitions"); + throw new FlowableException("Programmatic error: this operation can only be planned for Task plan item definitions. " + planItemInstanceEntity); } } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/agenda/operation/StartPlanItemInstanceOperation.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/agenda/operation/StartPlanItemInstanceOperation.java index 3eac920e621..7fe0318df82 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/agenda/operation/StartPlanItemInstanceOperation.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/agenda/operation/StartPlanItemInstanceOperation.java @@ -88,7 +88,7 @@ protected void executeActivityBehavior() { activityBehavior.execute(planItemInstanceEntity); } else { - throw new FlowableException("PlanItemInstance " + planItemInstanceEntity + " does not have a behavior"); + throw new FlowableException(planItemInstanceEntity + " does not have a behavior"); } } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/agenda/operation/TriggerPlanItemInstanceOperation.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/agenda/operation/TriggerPlanItemInstanceOperation.java index c192b928d1d..4b7b4bf9580 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/agenda/operation/TriggerPlanItemInstanceOperation.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/agenda/operation/TriggerPlanItemInstanceOperation.java @@ -54,7 +54,7 @@ protected void executeTrigger() { Object behaviorObject = planItemInstanceEntity.getPlanItem().getBehavior(); if (!(behaviorObject instanceof CmmnTriggerableActivityBehavior)) { throw new FlowableException("Cannot trigger a plan item which activity behavior does not implement the " - + CmmnTriggerableActivityBehavior.class + " interface"); + + CmmnTriggerableActivityBehavior.class + " interface in " + planItemInstanceEntity); } CmmnTriggerableActivityBehavior behavior = (CmmnTriggerableActivityBehavior) planItemInstanceEntity.getPlanItem().getBehavior(); if (behavior instanceof CoreCmmnTriggerableActivityBehavior) { diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/CasePageTaskActivityBehaviour.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/CasePageTaskActivityBehaviour.java index e26019603b7..836c76d7646 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/CasePageTaskActivityBehaviour.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/CasePageTaskActivityBehaviour.java @@ -122,7 +122,7 @@ protected String getExpressionValue(String value, PlanItemInstanceEntity planIte return expressionValue.toString(); } - throw new FlowableException("Unable to resolve expression value for " + value); + throw new FlowableException("Unable to resolve expression value for " + value + " in " + planItemInstanceEntity); } protected Collection getExpressionListValue(String value, PlanItemInstanceEntity planItemInstanceEntity, ExpressionManager expressionManager) { diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/CaseTaskActivityBehavior.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/CaseTaskActivityBehavior.java index 52cb318a158..9844c30aa9e 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/CaseTaskActivityBehavior.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/CaseTaskActivityBehavior.java @@ -80,7 +80,7 @@ public void execute(CommandContext commandContext, PlanItemInstanceEntity planIt } if (StringUtils.isEmpty(caseDefinitionKey)) { - throw new FlowableException("Could not start case instance: no case reference defined"); + throw new FlowableException("Could not start case instance: no case reference defined in " + planItemInstanceEntity); } CaseInstanceBuilder caseInstanceBuilder = new CaseInstanceBuilderImpl().caseDefinitionKey(caseDefinitionKey); @@ -233,7 +233,7 @@ public void deleteChildEntity(CommandContext commandContext, DelegatePlanItemIns } } else { - throw new FlowableException("Can only delete a child entity for a plan item with reference type " + ReferenceTypes.PLAN_ITEM_CHILD_CASE); + throw new FlowableException("Can only delete a child entity for a plan item with reference type " + ReferenceTypes.PLAN_ITEM_CHILD_CASE + " for " + delegatePlanItemInstance); } } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/DecisionTaskActivityBehavior.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/DecisionTaskActivityBehavior.java index 862329349f6..e09897e8e98 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/DecisionTaskActivityBehavior.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/DecisionTaskActivityBehavior.java @@ -60,7 +60,7 @@ public DecisionTaskActivityBehavior(Expression decisionRefExpression, DecisionTa public void execute(CommandContext commandContext, PlanItemInstanceEntity planItemInstanceEntity) { DmnDecisionService dmnRuleService = CommandContextUtil.getDmnRuleService(commandContext); if (dmnRuleService == null) { - throw new FlowableException("Could not execute decision instance: no dmn service found."); + throw new FlowableException("Could not execute decision instance: no dmn service found. For " + planItemInstanceEntity); } String externalRef = null; @@ -76,7 +76,7 @@ public void execute(CommandContext commandContext, PlanItemInstanceEntity planIt } if (StringUtils.isEmpty(externalRef)) { - throw new FlowableException("Could not execute decision: no externalRef defined"); + throw new FlowableException("Could not execute decision: no externalRef defined for " + planItemInstanceEntity); } } @@ -111,25 +111,25 @@ public void execute(CommandContext commandContext, PlanItemInstanceEntity planIt DecisionExecutionAuditContainer decisionExecutionAuditContainer = executeDecisionBuilder.executeWithAuditTrail(); if (decisionExecutionAuditContainer == null) { - throw new FlowableException("DMN decision with key " + externalRef + " was not executed."); + throw new FlowableException("DMN decision with key " + externalRef + " was not executed. For " + planItemInstanceEntity); } if (decisionExecutionAuditContainer.isFailed()) { - throw new FlowableException("DMN decision with key " + externalRef + " execution failed. Cause: " + decisionExecutionAuditContainer.getExceptionMessage()); + throw new FlowableException("DMN decision with key " + externalRef + " execution failed. Cause: " + decisionExecutionAuditContainer.getExceptionMessage() + ". For " + planItemInstanceEntity); } /* Throw error if there were no rules hit when the flag indicates to do this. */ String throwErrorFieldValue = getFieldString(EXPRESSION_DECISION_TABLE_THROW_ERROR_FLAG); if (decisionExecutionAuditContainer.getDecisionResult().isEmpty() && throwErrorFieldValue != null) { if ("true".equalsIgnoreCase(throwErrorFieldValue)) { - throw new FlowableException("DMN decision with key " + externalRef + " did not hit any rules for the provided input."); + throw new FlowableException("DMN decision with key " + externalRef + " did not hit any rules for the provided input. For " + planItemInstanceEntity); } else if (!"false".equalsIgnoreCase(throwErrorFieldValue)) { Expression expression = CommandContextUtil.getExpressionManager(commandContext).createExpression(throwErrorFieldValue); Object expressionValue = expression.getValue(planItemInstanceEntity); if (expressionValue instanceof Boolean && ((Boolean) expressionValue)) { - throw new FlowableException("DMN decision with key " + externalRef + " did not hit any rules for the provided input."); + throw new FlowableException("DMN decision with key " + externalRef + " did not hit any rules for the provided input. For " + planItemInstanceEntity); } } } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/EventRegistryEventListenerActivityBehaviour.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/EventRegistryEventListenerActivityBehaviour.java index 2576e38f35e..9f1b8f65456 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/EventRegistryEventListenerActivityBehaviour.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/EventRegistryEventListenerActivityBehaviour.java @@ -70,7 +70,7 @@ protected String resolveEventDefinitionKey(PlanItemInstanceEntity planItemInstan } if (key == null) { - throw new FlowableException("Could not resolve key from expression: " + eventDefinitionKeyExpression); + throw new FlowableException("Could not resolve key from expression: " + eventDefinitionKeyExpression + " for " + planItemInstanceEntity); } return key.toString(); diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/ExternalWorkerTaskActivityBehavior.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/ExternalWorkerTaskActivityBehavior.java index cba96acfd1e..8eec3489328 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/ExternalWorkerTaskActivityBehavior.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/ExternalWorkerTaskActivityBehavior.java @@ -64,7 +64,7 @@ public void execute(CommandContext commandContext, PlanItemInstanceEntity planIt String jobTopicExpression = beforeContext.getJobTopicExpression(); if (StringUtils.isEmpty(jobTopicExpression)) { - throw new FlowableException("no topic expression configured"); + throw new FlowableException("no topic expression configured for " + planItemInstanceEntity); } JobServiceConfiguration jobServiceConfiguration = cmmnEngineConfiguration.getJobServiceConfiguration(); @@ -102,7 +102,7 @@ public void execute(CommandContext commandContext, PlanItemInstanceEntity planIt if (expressionValue != null && !expressionValue.toString().isEmpty()) { job.setJobHandlerConfiguration(expressionValue.toString()); } else { - throw new FlowableException("Expression " + jobTopicExpression + " did not evaluate to a valid value (non empty String). Was: " + expressionValue); + throw new FlowableException("Expression " + jobTopicExpression + " did not evaluate to a valid value (non empty String). Was: " + expressionValue + ". For " + planItemInstanceEntity); } jobService.insertExternalWorkerJob(job); diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/HumanTaskActivityBehavior.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/HumanTaskActivityBehavior.java index e1de105eae7..3c94e952f93 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/HumanTaskActivityBehavior.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/HumanTaskActivityBehavior.java @@ -397,7 +397,7 @@ public void trigger(CommandContext commandContext, PlanItemInstanceEntity planIt TaskService taskService = cmmnEngineConfiguration.getTaskServiceConfiguration().getTaskService(); List taskEntities = taskService.findTasksBySubScopeIdScopeType(planItemInstance.getId(), ScopeTypes.CMMN); if (taskEntities == null || taskEntities.isEmpty()) { - throw new FlowableException("No task entity found for plan item instance " + planItemInstance.getId()); + throw new FlowableException("No task entity found for " + planItemInstance); } // Should be only one diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/ProcessTaskActivityBehavior.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/ProcessTaskActivityBehavior.java index 9f4277b9f39..7f439995c6e 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/ProcessTaskActivityBehavior.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/ProcessTaskActivityBehavior.java @@ -69,7 +69,7 @@ public void execute(CommandContext commandContext, PlanItemInstanceEntity planIt CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext); ProcessInstanceService processInstanceService = cmmnEngineConfiguration.getProcessInstanceService(); if (processInstanceService == null) { - throw new FlowableException("Could not start process instance: no " + ProcessInstanceService.class + " implementation found"); + throw new FlowableException("Could not start process instance: no " + ProcessInstanceService.class + " implementation found for " + planItemInstanceEntity); } String externalRef = null; @@ -81,7 +81,7 @@ public void execute(CommandContext commandContext, PlanItemInstanceEntity planIt externalRef = processRef; } if (StringUtils.isEmpty(externalRef)) { - throw new FlowableException("Could not start process instance: no externalRef defined"); + throw new FlowableException("Could not start process instance: no externalRef defined for " + planItemInstanceEntity); } Map inParametersMap = new HashMap<>(); @@ -147,7 +147,7 @@ public void trigger(CommandContext commandContext, PlanItemInstanceEntity planIt } if (!ReferenceTypes.PLAN_ITEM_CHILD_PROCESS.equals(planItemInstance.getReferenceType())) { throw new FlowableException("Cannot trigger process task plan item instance : reference type '" - + planItemInstance.getReferenceType() + "' not supported"); + + planItemInstance.getReferenceType() + "' not supported for " + planItemInstance); } // Need to be set before planning the complete operation @@ -182,7 +182,7 @@ public void deleteChildEntity(CommandContext commandContext, DelegatePlanItemIns delegatePlanItemInstance.setState(PlanItemInstanceState.TERMINATED); // This is not the regular termination, but the state still needs to be correct deleteProcessInstance(commandContext, delegatePlanItemInstance); } else { - throw new FlowableException("Can only delete a child entity for a plan item with reference type " + ReferenceTypes.PLAN_ITEM_CHILD_PROCESS); + throw new FlowableException("Can only delete a child entity for a plan item with reference type " + ReferenceTypes.PLAN_ITEM_CHILD_PROCESS + " for " + delegatePlanItemInstance); } } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/ScriptTaskActivityBehavior.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/ScriptTaskActivityBehavior.java index b07cbc2f745..b70c3a0999c 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/ScriptTaskActivityBehavior.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/ScriptTaskActivityBehavior.java @@ -38,7 +38,7 @@ public ScriptTaskActivityBehavior(ScriptServiceTask scriptTask) { public void execute(CommandContext commandContext, PlanItemInstanceEntity planItemInstanceEntity) { ScriptingEngines scriptingEngines = CommandContextUtil.getCmmnEngineConfiguration().getScriptingEngines(); if (scriptingEngines == null) { - throw new FlowableException("Could not execute script task instance: no scripting engines found."); + throw new FlowableException("Could not execute script task instance: no scripting engines found. For " + planItemInstanceEntity); } String scriptFormat = scriptTask.getScriptFormat() != null ? scriptTask.getScriptFormat() : ScriptingEngines.DEFAULT_SCRIPTING_LANGUAGE; diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/SendEventActivityBehavior.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/SendEventActivityBehavior.java index f77a3a7fbaa..fd27e6615ac 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/SendEventActivityBehavior.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/SendEventActivityBehavior.java @@ -54,7 +54,7 @@ public SendEventActivityBehavior(SendEventServiceTask serviceTask) { @Override public void execute(CommandContext commandContext, PlanItemInstanceEntity planItemInstanceEntity) { - String key = getEventKey(); + String key = getEventKey(planItemInstanceEntity); EventRegistry eventRegistry = CommandContextUtil.getEventRegistry(); @@ -86,7 +86,7 @@ protected EventModel getEventModel(PlanItemInstanceEntity planItemInstanceEntity } if (eventModel == null) { - throw new FlowableException("No event model found for event key " + key); + throw new FlowableException("No event model found for event key " + key + " for " + planItemInstanceEntity); } return eventModel; } @@ -133,7 +133,7 @@ protected List getChannelModels(CommandContext commandContext, Pla if (channelKeys.isEmpty()) { if (!sendOnSystemChannel) { // If the event is going to be send on the system channel then it is allowed to not define any other channels - throw new FlowableException("No channel keys configured"); + throw new FlowableException("No channel keys configured for " + planItemInstanceEntity); } else { return Collections.emptyList(); } @@ -152,11 +152,11 @@ protected List getChannelModels(CommandContext commandContext, Pla return channelModels; } - protected String getEventKey() { + protected String getEventKey(PlanItemInstanceEntity planItemInstanceEntity) { if (StringUtils.isNotEmpty(serviceTask.getEventType())) { return serviceTask.getEventType(); } else { - throw new FlowableException("No event key configured for " + serviceTask.getId()); + throw new FlowableException("No event key configured for " + serviceTask.getId() + " for " + planItemInstanceEntity); } } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/TimerEventListenerActivityBehaviour.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/TimerEventListenerActivityBehaviour.java index 1e5434e047c..940501e31e4 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/TimerEventListenerActivityBehaviour.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/TimerEventListenerActivityBehaviour.java @@ -139,7 +139,7 @@ protected void handleCreateTransition(CommandContext commandContext, PlanItemIns if (timerDueDate == null) { throw new FlowableException("Timer expression '" + timerEventListener.getTimerExpression() + "' did not resolve to java.util.Date, org.joda.time.DateTime, " + "java.time.Instant, " - + "an ISO8601 date/duration/repetition string or a cron expression"); + + "an ISO8601 date/duration/repetition string or a cron expression for " + planItemInstance); } scheduleTimerJob(commandContext, planItemInstance, timerValue, timerDueDate, isRepeating); diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/http/DefaultCmmnHttpActivityDelegate.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/http/DefaultCmmnHttpActivityDelegate.java index 106371235a1..62f5c4ddbd3 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/http/DefaultCmmnHttpActivityDelegate.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/http/DefaultCmmnHttpActivityDelegate.java @@ -74,7 +74,8 @@ public CompletableFuture execute(DelegatePlanItemInstance planIte if (e instanceof FlowableException) { throw (FlowableException) e; } else { - throw new FlowableException(HTTP_TASK_REQUEST_FIELD_INVALID + " in execution " + planItemInstance.getId(), e); + throw new FlowableException(HTTP_TASK_REQUEST_FIELD_INVALID + " in plan item instance " + planItemInstance.getId() + " in plan item " + + planItemInstance.getPlanItemDefinitionId() + " in case definition " + planItemInstance.getCaseDefinitionId(), e); } } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/AbstractExternalWorkerJobCmd.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/AbstractExternalWorkerJobCmd.java index 606d7ba85aa..ab0fdc64378 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/AbstractExternalWorkerJobCmd.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/AbstractExternalWorkerJobCmd.java @@ -45,8 +45,7 @@ public final Void execute(CommandContext commandContext) { ExternalWorkerJobEntity externalWorkerJob = resolveJob(commandContext); if (!ScopeTypes.CMMN.equals(externalWorkerJob.getScopeType())) { - throw new FlowableException( - "External worker job with id " + externalJobId + " is not cmmn scoped. This command can only handle cmmn scoped external worker jobs"); + throw new FlowableException(externalWorkerJob + " is not cmmn scoped. This command can only handle cmmn scoped external worker jobs"); } runJobLogic(externalWorkerJob, commandContext); diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/ClaimTaskCmd.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/ClaimTaskCmd.java index 1f32fc81b51..9f27ed6e6c6 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/ClaimTaskCmd.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/ClaimTaskCmd.java @@ -85,8 +85,8 @@ protected Void execute(CommandContext commandContext, TaskEntity task) { } @Override - protected String getSuspendedTaskException() { - return "Cannot claim a suspended task"; + protected String getSuspendedTaskExceptionPrefix() { + return "Cannot claim"; } } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/CompleteTaskCmd.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/CompleteTaskCmd.java index 25df6ed01d9..689be50ec7a 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/CompleteTaskCmd.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/CompleteTaskCmd.java @@ -86,7 +86,7 @@ public Void execute(CommandContext commandContext) { } if (StringUtils.isNotEmpty(taskEntity.getProcessInstanceId())) { - throw new FlowableException("The task instance is created by the process engine and should be completed via the process engine API"); + throw new FlowableException(taskEntity + " is created by the process engine and should be completed via the process engine API"); } String planItemInstanceId = taskEntity.getSubScopeId(); @@ -94,7 +94,7 @@ public Void execute(CommandContext commandContext) { if (planItemInstanceId != null) { planItemInstanceEntity = cmmnEngineConfiguration.getPlanItemInstanceEntityManager().findById(planItemInstanceId); if (planItemInstanceEntity == null) { - throw new FlowableException("Could not find plan item instance for task " + taskId); + throw new FlowableException("Could not find plan item instance for " + taskEntity); } } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/CompleteTaskWithFormCmd.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/CompleteTaskWithFormCmd.java index 883f74c9fd8..80ff19eb192 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/CompleteTaskWithFormCmd.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/CompleteTaskWithFormCmd.java @@ -109,7 +109,7 @@ public CompleteTaskWithFormCmd(String taskId, String formDefinitionId, String ou @Override protected Void execute(CommandContext commandContext, TaskEntity task) { if (StringUtils.isNotEmpty(task.getProcessInstanceId())) { - throw new FlowableException("The task instance is created by the process engine and should be completed via the process engine API"); + throw new FlowableException(task + " is created by the process engine and should be completed via the process engine API"); } FormService formService = CommandContextUtil.getFormService(commandContext); @@ -180,7 +180,7 @@ protected void completeTask(CommandContext commandContext, TaskEntity task, Map< String planItemInstanceId = task.getSubScopeId(); PlanItemInstanceEntity planItemInstanceEntity = cmmnEngineConfiguration.getPlanItemInstanceEntityManager().findById(planItemInstanceId); if (planItemInstanceEntity == null) { - throw new FlowableException("Could not find plan item instance for task " + taskId); + throw new FlowableException("Could not find plan item instance for " + task); } if (taskVariables != null) { @@ -222,8 +222,8 @@ protected void completeTask(CommandContext commandContext, TaskEntity task, Map< } @Override - protected String getSuspendedTaskException() { - return "Cannot complete a suspended task"; + protected String getSuspendedTaskExceptionPrefix() { + return "Cannot complete"; } } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DelegateTaskCmd.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DelegateTaskCmd.java index 39b5a7a35a4..fe3b6fa204d 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DelegateTaskCmd.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DelegateTaskCmd.java @@ -47,8 +47,8 @@ protected Object execute(CommandContext commandContext, TaskEntity task) { } @Override - protected String getSuspendedTaskException() { - return "Cannot delegate a suspended task"; + protected String getSuspendedTaskExceptionPrefix() { + return "Cannot delegate"; } } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DeleteHistoricCaseInstanceCmd.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DeleteHistoricCaseInstanceCmd.java index 528f43998cc..72446d03df1 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DeleteHistoricCaseInstanceCmd.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DeleteHistoricCaseInstanceCmd.java @@ -50,7 +50,7 @@ public Object execute(CommandContext commandContext) { throw new FlowableObjectNotFoundException("No historic case instance found with id: " + caseInstanceId, HistoricCaseInstance.class); } if (instance.getEndTime() == null) { - throw new FlowableException("Case instance is still running, cannot delete historic case instance: " + caseInstanceId); + throw new FlowableException("Case instance is still running, cannot delete " + instance); } cmmnEngineConfiguration.getCmmnHistoryManager().recordHistoricCaseInstanceDeleted(caseInstanceId, instance.getTenantId()); diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DeleteHistoricTaskInstanceCmd.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DeleteHistoricTaskInstanceCmd.java index e42f21c8e51..4a4adbeccf4 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DeleteHistoricTaskInstanceCmd.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DeleteHistoricTaskInstanceCmd.java @@ -51,7 +51,7 @@ public Object execute(CommandContext commandContext) { throw new FlowableObjectNotFoundException("No historic task instance found with id: " + taskId, HistoricTaskInstance.class); } if (historicTaskInstance.getEndTime() == null) { - throw new FlowableException("task does not have an endTime, cannot delete historic task instance: " + taskId); + throw new FlowableException("task does not have an endTime, cannot delete " + historicTaskInstance); } CommandContextUtil.getCmmnHistoryManager(commandContext).recordHistoricTaskDeleted(historicTaskInstance); diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetStageOverviewCmd.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetStageOverviewCmd.java index 7aea4b1c79f..9125f066cf3 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetStageOverviewCmd.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetStageOverviewCmd.java @@ -139,7 +139,7 @@ protected boolean evaluateIncludeInStageOverviewExpression(Expression stageExpre Object stageValueObject = stageExpression.getValue(variableContainer); if (!(stageValueObject instanceof Boolean)) { throw new FlowableException("Include in stage overview expression does not resolve to a boolean value " + - includeInStageOverview + ": " + stageValueObject); + includeInStageOverview + ": " + stageValueObject + " for " + variableContainer); } return (Boolean) stageValueObject; diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/NeedsActiveTaskCmd.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/NeedsActiveTaskCmd.java index bb1b57bd8cd..9c05c035a1a 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/NeedsActiveTaskCmd.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/NeedsActiveTaskCmd.java @@ -54,7 +54,7 @@ public T execute(CommandContext commandContext) { } if (task.isSuspended()) { - throw new FlowableException(getSuspendedTaskException()); + throw new FlowableException(getSuspendedTaskExceptionPrefix() + " a suspended " + task); } return execute(commandContext, task); @@ -68,8 +68,8 @@ public T execute(CommandContext commandContext) { /** * Subclasses can override this method to provide a customized exception message that will be thrown when the task is suspended. */ - protected String getSuspendedTaskException() { - return "Cannot execute operation: task is suspended"; + protected String getSuspendedTaskExceptionPrefix() { + return "Cannot execute operation for"; } } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/RemoveTaskVariablesCmd.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/RemoveTaskVariablesCmd.java index 2d71c72901b..bd707cf68bc 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/RemoveTaskVariablesCmd.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/RemoveTaskVariablesCmd.java @@ -46,8 +46,8 @@ protected Void execute(CommandContext commandContext, TaskEntity task) { } @Override - protected String getSuspendedTaskException() { - return "Cannot remove variables from a suspended task."; + protected String getSuspendedTaskExceptionPrefix() { + return "Cannot remove variables from"; } } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/ResolveTaskCmd.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/ResolveTaskCmd.java index aa77f7e706c..500a8d93a60 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/ResolveTaskCmd.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/ResolveTaskCmd.java @@ -60,8 +60,8 @@ protected Void execute(CommandContext commandContext, TaskEntity task) { } @Override - protected String getSuspendedTaskException() { - return "Cannot resolve a suspended task"; + protected String getSuspendedTaskExceptionPrefix() { + return "Cannot resolve"; } } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/SetTaskVariablesCmd.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/SetTaskVariablesCmd.java index 227401cc9c5..4194cd81bc1 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/SetTaskVariablesCmd.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/SetTaskVariablesCmd.java @@ -62,8 +62,8 @@ protected Object execute(CommandContext commandContext, TaskEntity task) { } @Override - protected String getSuspendedTaskException() { - return "Cannot add variables to a suspended task"; + protected String getSuspendedTaskExceptionPrefix() { + return "Cannot add variables to"; } } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/StartProgressTaskCmd.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/StartProgressTaskCmd.java index 26c6c705e9e..f9a8a03c5aa 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/StartProgressTaskCmd.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/StartProgressTaskCmd.java @@ -53,8 +53,8 @@ protected Void execute(CommandContext commandContext, TaskEntity task) { } @Override - protected String getSuspendedTaskException() { - return "Cannot start progress on a suspended task"; + protected String getSuspendedTaskExceptionPrefix() { + return "Cannot start progress on"; } } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/SuspendTaskCmd.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/SuspendTaskCmd.java index 54c63051e1e..a3d196fbf5c 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/SuspendTaskCmd.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/SuspendTaskCmd.java @@ -51,8 +51,8 @@ protected Void execute(CommandContext commandContext, TaskEntity task) { } @Override - protected String getSuspendedTaskException() { - return "Cannot suspend on a suspended task"; + protected String getSuspendedTaskExceptionPrefix() { + return "Cannot suspend on"; } } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/DefaultCmmnHistoryManager.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/DefaultCmmnHistoryManager.java index f8bd29b292c..c6356ccb57e 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/DefaultCmmnHistoryManager.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/DefaultCmmnHistoryManager.java @@ -501,7 +501,7 @@ public boolean evaluateShowInOverview(PlanItemInstanceEntity planItemInstanceEnt Object stageValueObject = stageExpression.getValue(planItemInstanceEntity); if (!(stageValueObject instanceof Boolean)) { throw new FlowableException("Include in stage overview expression does not resolve to a boolean value " + - includeInStageOverviewValue + ": " + stageValueObject); + includeInStageOverviewValue + ": " + stageValueObject + " for " + planItemInstanceEntity); } showInOverview = (Boolean) stageValueObject; diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/job/AsyncLeaveActivePlanItemInstanceJobHandler.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/job/AsyncLeaveActivePlanItemInstanceJobHandler.java index 2512d2a6d65..fe239023118 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/job/AsyncLeaveActivePlanItemInstanceJobHandler.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/job/AsyncLeaveActivePlanItemInstanceJobHandler.java @@ -69,7 +69,7 @@ public void execute(JobEntity job, String configuration, VariableScope variableS CommandContextUtil.getAgenda(commandContext).planTerminatePlanItemInstanceOperation(planItemInstanceEntity, exitType, exitEventType); } else { - throw new FlowableException("Programmatic error: unsupported transition " + transition); + throw new FlowableException("Programmatic error: unsupported transition " + transition + " for " + planItemInstanceEntity); } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/CaseInstanceEntityImpl.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/CaseInstanceEntityImpl.java index 87ce27ef4eb..e018115a251 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/CaseInstanceEntityImpl.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/CaseInstanceEntityImpl.java @@ -484,4 +484,17 @@ public String getCaseDefinitionDeploymentId() { public void setCaseDefinitionDeploymentId(String caseDefinitionDeploymentId) { this.caseDefinitionDeploymentId = caseDefinitionDeploymentId; } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("CaseInstance[id=").append(id) + .append(", caseDefinitionId=").append(caseDefinitionId); + + if (StringUtils.isNotEmpty(tenantId)) { + sb.append(", tenantId=").append(tenantId); + } + + return sb.toString(); + } } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/HistoricCaseInstanceEntityImpl.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/HistoricCaseInstanceEntityImpl.java index a10e3d1330b..89af97902c7 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/HistoricCaseInstanceEntityImpl.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/HistoricCaseInstanceEntityImpl.java @@ -308,4 +308,17 @@ public String getCaseDefinitionDeploymentId() { public void setCaseDefinitionDeploymentId(String caseDefinitionDeploymentId) { this.caseDefinitionDeploymentId = caseDefinitionDeploymentId; } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("HistoricCaseInstance[id=").append(id) + .append(", caseDefinitionId=").append(caseDefinitionId); + + if (StringUtils.isNotEmpty(tenantId)) { + sb.append(", tenantId=").append(tenantId); + } + + return sb.toString(); + } } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/HistoricPlanItemInstanceEntityImpl.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/HistoricPlanItemInstanceEntityImpl.java index bc71ae5a0c8..492779bc05f 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/HistoricPlanItemInstanceEntityImpl.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/HistoricPlanItemInstanceEntityImpl.java @@ -465,4 +465,30 @@ public String getLocalizedName() { public void setLocalizedName(String localizedName) { this.localizedName = localizedName; } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("HistoricPlanItemInstance with id: ") + .append(id); + + if (getName() != null) { + sb.append(", name: ").append(getName()); + } + sb.append(", definitionId: ") + .append(planItemDefinitionId) + .append(", state: ") + .append(state); + + sb + .append(", caseInstanceId: ") + .append(caseInstanceId) + .append(", caseDefinitionId: ") + .append(caseDefinitionId); + + if (StringUtils.isNotEmpty(tenantId)) { + sb.append(", tenantId=").append(tenantId); + } + return sb.toString(); + } } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/PlanItemInstanceEntityImpl.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/PlanItemInstanceEntityImpl.java index ffc11a51b2a..c6cb0be4463 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/PlanItemInstanceEntityImpl.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/PlanItemInstanceEntityImpl.java @@ -659,6 +659,20 @@ public String toString() { .append(planItemDefinitionId) .append(", state: ") .append(state); + + if (elementId != null) { + stringBuilder.append(", elementId: ").append(elementId); + } + + stringBuilder + .append(", caseInstanceId: ") + .append(caseInstanceId) + .append(", caseDefinitionId: ") + .append(caseDefinitionId); + + if (StringUtils.isNotEmpty(tenantId)) { + stringBuilder.append(", tenantId=").append(tenantId); + } return stringBuilder.toString(); } } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/data/impl/MybatisCaseDefinitionDataManager.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/data/impl/MybatisCaseDefinitionDataManager.java index 9b2e19470fe..011ad2097fa 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/data/impl/MybatisCaseDefinitionDataManager.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/data/impl/MybatisCaseDefinitionDataManager.java @@ -121,7 +121,9 @@ public CaseDefinitionEntity findCaseDefinitionByKeyAndVersionAndTenantId(String if (results.size() == 1) { return results.get(0); } else if (results.size() > 1) { - throw new FlowableException("There are " + results.size() + " case definitions with key = '" + caseDefinitionKey + "' and version = '" + caseDefinitionVersion + "'."); + throw new FlowableException( + "There are " + results.size() + " case definitions with key = '" + caseDefinitionKey + "' and version = '" + caseDefinitionVersion + + "' in tenant = '" + tenantId + "'."); } return null; } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/task/TaskHelper.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/task/TaskHelper.java index 940c29348e4..5caf68b0d8c 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/task/TaskHelper.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/task/TaskHelper.java @@ -70,9 +70,9 @@ public static void deleteTask(String taskId, String deleteReason, boolean cascad TaskEntity task = cmmnEngineConfiguration.getTaskServiceConfiguration().getTaskService().getTask(taskId); if (task != null) { if (task.getScopeId() != null && ScopeTypes.CMMN.equals(task.getScopeType())) { - throw new FlowableException("The task cannot be deleted because is part of a running case instance"); + throw new FlowableException("The " + task + " cannot be deleted because is part of a running case instance"); } else if (task.getExecutionId() != null) { - throw new FlowableException("The task cannot be deleted because is part of a running process instance"); + throw new FlowableException("The " + task + " cannot be deleted because is part of a running process instance"); } deleteTask(task, deleteReason, cascade, true, cmmnEngineConfiguration); @@ -252,7 +252,7 @@ public static boolean isFormFieldValidationEnabled(VariableContainer variableCon expressionManager.createExpression(formFieldValidationExpression).getValue(variableContainer) ); if (formFieldValidationValue == null) { - throw new FlowableException("Unable to resolve formFieldValidationExpression to boolean value"); + throw new FlowableException("Unable to resolve formFieldValidationExpression to boolean value for " + variableContainer); } return formFieldValidationValue; } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/util/ExpressionUtil.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/util/ExpressionUtil.java index 0ce8cb382b7..56a20667a62 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/util/ExpressionUtil.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/util/ExpressionUtil.java @@ -45,7 +45,7 @@ public static boolean evaluateBooleanExpression(CommandContext commandContext, V } else if (evaluationResult instanceof String) { return "true".equals(((String) evaluationResult).toLowerCase()); } else { - throw new FlowableException("Expression condition " + condition + " did not evaluate to a boolean value"); + throw new FlowableException("Expression condition " + condition + " did not evaluate to a boolean value with " + variableContainer); } } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/util/PlanItemInstanceContainerUtil.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/util/PlanItemInstanceContainerUtil.java index 6b60b6f0e90..51544dfdc33 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/util/PlanItemInstanceContainerUtil.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/util/PlanItemInstanceContainerUtil.java @@ -218,7 +218,7 @@ public static boolean isPlanItemAlreadyCompleted(CommandContext commandContext, */ public static boolean isParentCompletionRuleForPlanItemEqualToType(PlanItemInstanceEntity planItemInstance, String parentCompletionRuleType) { if (planItemInstance.getPlanItem() == null) { - throw new FlowableException("Plan item could not be found for " + planItemInstance.getElementId()); + throw new FlowableException("Plan item could not be found for " + planItemInstance); } if (planItemInstance.getPlanItem().getItemControl() != null && planItemInstance.getPlanItem().getItemControl().getParentCompletionRule() != null) { diff --git a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/externalworker/ExternalWorkerServiceTaskTest.java b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/externalworker/ExternalWorkerServiceTaskTest.java index 459258bd460..40f40fa2914 100644 --- a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/externalworker/ExternalWorkerServiceTaskTest.java +++ b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/externalworker/ExternalWorkerServiceTaskTest.java @@ -1235,7 +1235,11 @@ public void testUnaquireWithJobIdWrongWorkerId() { cmmnManagementService.unacquireExternalWorkerJob(job.getId(), "testWorker2"); }).isInstanceOf(FlowableException.class) - .hasMessageContaining("Job is locked with a different worker id"); + .hasMessage("ExternalWorkerJobEntity[id=" + job.getId() + + ", jobHandlerType=cmmn-external-worker-complete, jobType=externalWorker, elementId=externalWorkerTask, correlationId=" + + job.getCorrelationId() + ", scopeId=" + job.getScopeId() + + ", subScopeId=" + job.getSubScopeId() + ", scopeType=cmmn, scopeDefinitionId=" + job.getScopeDefinitionId() + + "] is locked with a different worker id");; cmmnManagementService.unacquireExternalWorkerJob(job.getId(), "testWorker1"); assertThat(query.count()).isEqualTo(0); diff --git a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/logging/ServiceTaskLoggingTest.java b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/logging/ServiceTaskLoggingTest.java index 83b2d3df0d3..4a5616396a9 100644 --- a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/logging/ServiceTaskLoggingTest.java +++ b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/logging/ServiceTaskLoggingTest.java @@ -617,7 +617,10 @@ public void testSentryConditionLogging() { assertThat(loggingNode.get("elementId").asText()).isEqualTo("stage1"); assertThat(loggingNode.get("elementName").asText()).isEqualTo("Stage 1"); assertThat(loggingNode.get("elementType").asText()).isEqualTo("Stage"); - assertThat(loggingNode.get("exception").get("message").asText()).isEqualTo("Unknown property used in expression: ${gotoStage1}"); + assertThat(loggingNode.get("exception").get("message").asText()) + .startsWith("Unknown property used in expression: ${gotoStage1} with PlanItemInstance with id: ") + .contains("name: Stage 1", "definitionId: stage1", "state: available", "elementId: planItem2", "caseInstanceId: " + caseInstance.getId(), + "caseDefinitionId: " + caseDefinition.getId()); assertThat(loggingNode.get("exception").get("stackTrace").asText()).isNotNull(); assertThat(loggingNode.get(LoggingSessionUtil.LOG_NUMBER).asInt()).isEqualTo(4); assertThat(loggingNode.get(LoggingSessionUtil.TIMESTAMP).asText()).isNotNull(); diff --git a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/migration/CaseInstanceMigrationTest.java b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/migration/CaseInstanceMigrationTest.java index bb87f0f85f6..76c861fffd2 100644 --- a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/migration/CaseInstanceMigrationTest.java +++ b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/migration/CaseInstanceMigrationTest.java @@ -700,7 +700,11 @@ void withChangingPlanItemId() { cmmnMigrationService.createCaseInstanceMigrationBuilder() .migrateToCaseDefinition(destinationDefinition.getId()) .migrate(caseInstance.getId()); - }).isInstanceOf(FlowableException.class).hasMessage("Plan item could not be found for planItem1"); + }).isInstanceOf(FlowableException.class) + .hasMessageStartingWith("Plan item could not be found for PlanItemInstance with id: ") + .hasMessageContainingAll("name: Task 1", "definitionId: humanTask1", "state: active", "elementId: planItem1", + "caseInstanceId: " + caseInstance.getId(), + "caseDefinitionId: " + destinationDefinition.getId()); cmmnMigrationService.createCaseInstanceMigrationBuilder() .migrateToCaseDefinition(destinationDefinition.getId()) @@ -767,7 +771,11 @@ void withChangingPlanItemIdWithDefinitionId() { cmmnMigrationService.createCaseInstanceMigrationBuilder() .migrateToCaseDefinition(destinationDefinition.getId()) .migrate(caseInstance.getId()); - }).isInstanceOf(FlowableException.class).hasMessage("Plan item could not be found for planItem1"); + }).isInstanceOf(FlowableException.class) + .hasMessageStartingWith("Plan item could not be found for PlanItemInstance with id: ") + .hasMessageContainingAll("name: Task 1", "definitionId: humanTask1", "state: active", "elementId: planItem1", + "caseInstanceId: " + caseInstance.getId(), + "caseDefinitionId: " + destinationDefinition.getId()); cmmnMigrationService.createCaseInstanceMigrationBuilder() .migrateToCaseDefinition(destinationDefinition.getId()) @@ -910,7 +918,11 @@ void withMilestoneAndChangingPlanItemId() { cmmnMigrationService.createCaseInstanceMigrationBuilder() .migrateToCaseDefinition(destinationDefinition.getId()) .migrate(caseInstance.getId()); - }).isInstanceOf(FlowableException.class).hasMessage("Plan item could not be found for planItem1"); + }).isInstanceOf(FlowableException.class) + .hasMessageStartingWith("Plan item could not be found for PlanItemInstance with id: ") + .hasMessageContainingAll("name: Task 1", "definitionId: humanTask1", "state: active", "elementId: planItem1", + "caseInstanceId: " + caseInstance.getId(), + "caseDefinitionId: " + destinationDefinition.getId()); cmmnMigrationService.createCaseInstanceMigrationBuilder() .migrateToCaseDefinition(destinationDefinition.getId()) @@ -1001,7 +1013,11 @@ void withMilestoneAndChangingPlanItemIdWithDefinitionId() { cmmnMigrationService.createCaseInstanceMigrationBuilder() .migrateToCaseDefinition(destinationDefinition.getId()) .migrate(caseInstance.getId()); - }).isInstanceOf(FlowableException.class).hasMessage("Plan item could not be found for planItem1"); + }).isInstanceOf(FlowableException.class) + .hasMessageStartingWith("Plan item could not be found for PlanItemInstance with id: ") + .hasMessageContainingAll("name: Task 1", "definitionId: humanTask1", "state: active", "elementId: planItem1", + "caseInstanceId: " + caseInstance.getId(), + "caseDefinitionId: " + destinationDefinition.getId()); cmmnMigrationService.createCaseInstanceMigrationBuilder() .migrateToCaseDefinition(destinationDefinition.getId()) @@ -1096,7 +1112,11 @@ void withIfSentryEventDeferredAndChangingPlanItemId() { cmmnMigrationService.createCaseInstanceMigrationBuilder() .migrateToCaseDefinition(destinationDefinition.getId()) .migrate(caseInstance.getId()); - }).isInstanceOf(FlowableException.class).hasMessage("Plan item could not be found for planItem1"); + }).isInstanceOf(FlowableException.class) + .hasMessageStartingWith("Plan item could not be found for PlanItemInstance with id: ") + .hasMessageContainingAll("name: Task 1", "definitionId: humanTask1", "state: active", "elementId: planItem1", + "caseInstanceId: " + caseInstance.getId(), + "caseDefinitionId: " + destinationDefinition.getId()); cmmnMigrationService.createCaseInstanceMigrationBuilder() .migrateToCaseDefinition(destinationDefinition.getId()) @@ -1201,7 +1221,11 @@ void withIfSentryEventDeferredAndChangingPlanItemIdWithDefinitionId() { cmmnMigrationService.createCaseInstanceMigrationBuilder() .migrateToCaseDefinition(destinationDefinition.getId()) .migrate(caseInstance.getId()); - }).isInstanceOf(FlowableException.class).hasMessage("Plan item could not be found for planItem1"); + }).isInstanceOf(FlowableException.class) + .hasMessageStartingWith("Plan item could not be found for PlanItemInstance with id: ") + .hasMessageContainingAll("name: Task 1", "definitionId: humanTask1", "state: active", "elementId: planItem1", + "caseInstanceId: " + caseInstance.getId(), + "caseDefinitionId: " + destinationDefinition.getId()); cmmnMigrationService.createCaseInstanceMigrationBuilder() .migrateToCaseDefinition(destinationDefinition.getId()) diff --git a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/ServiceTaskTest.java b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/ServiceTaskTest.java index 5bff50e44a0..c0cbce334ce 100644 --- a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/ServiceTaskTest.java +++ b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/ServiceTaskTest.java @@ -484,7 +484,9 @@ public void invoke() { }) .start()) .isExactlyInstanceOf(FlowableException.class) - .hasMessage("Error while evaluating expression: ${testBean.invoke()}") + .hasMessageStartingWith("Error while evaluating expression: ${testBean.invoke()} with PlanItemInstance with id: ") + .hasMessageContainingAll("name: Task One", "definitionId: serviceTask", "state: active", "elementId: planItem1", + "caseInstanceId: ", "caseDefinitionId: ") .cause() .isInstanceOf(ELException.class) .cause() @@ -506,7 +508,9 @@ public void invoke() { }) .start()) .isExactlyInstanceOf(FlowableException.class) - .hasMessage("Error while evaluating expression: ${testBean.invoke()}") + .hasMessageStartingWith("Error while evaluating expression: ${testBean.invoke()} with PlanItemInstance with id: ") + .hasMessageContainingAll("name: Task One", "definitionId: serviceTask", "state: active", "elementId: planItem1", + "caseInstanceId: ", "caseDefinitionId: ") .cause() .isInstanceOf(ELException.class) .cause() diff --git a/modules/flowable-common-rest/src/main/java/org/flowable/common/rest/exception/BaseExceptionHandlerAdvice.java b/modules/flowable-common-rest/src/main/java/org/flowable/common/rest/exception/BaseExceptionHandlerAdvice.java index 4a44d3402c6..dcb37b0b0a1 100644 --- a/modules/flowable-common-rest/src/main/java/org/flowable/common/rest/exception/BaseExceptionHandlerAdvice.java +++ b/modules/flowable-common-rest/src/main/java/org/flowable/common/rest/exception/BaseExceptionHandlerAdvice.java @@ -14,6 +14,8 @@ import java.util.UUID; +import jakarta.servlet.http.HttpServletRequest; + import org.flowable.common.engine.api.FlowableForbiddenException; import org.flowable.common.engine.api.FlowableIllegalArgumentException; import org.flowable.common.engine.api.FlowableIllegalStateException; @@ -36,7 +38,7 @@ @ControllerAdvice public class BaseExceptionHandlerAdvice { - private static final Logger LOGGER = LoggerFactory.getLogger(BaseExceptionHandlerAdvice.class); + protected final Logger logger = LoggerFactory.getLogger(getClass()); /** * Flag indicating whether to send the full error exception message for unknown exceptions. @@ -48,54 +50,75 @@ public class BaseExceptionHandlerAdvice { @ResponseStatus(HttpStatus.UNSUPPORTED_MEDIA_TYPE) // 415 @ExceptionHandler(FlowableContentNotSupportedException.class) @ResponseBody - public ErrorInfo handleNotSupported(FlowableContentNotSupportedException e) { + public ErrorInfo handleNotSupported(FlowableContentNotSupportedException e, HttpServletRequest request) { + if (logger.isDebugEnabled()) { + logger.debug("Content is not supported. Message: {}, Request: {} {}", e.getMessage(), request.getMethod(), request.getRequestURI()); + } return new ErrorInfo("Content is not supported", e); } @ResponseStatus(HttpStatus.CONFLICT) // 409 @ExceptionHandler(FlowableConflictException.class) @ResponseBody - public ErrorInfo handleConflict(FlowableConflictException e) { + public ErrorInfo handleConflict(FlowableConflictException e, HttpServletRequest request) { + if (logger.isDebugEnabled()) { + logger.debug("Conflict. Message: {}, Request: {} {}", e.getMessage(), request.getMethod(), request.getRequestURI()); + } return new ErrorInfo("Conflict", e); } @ResponseStatus(HttpStatus.NOT_FOUND) // 404 @ExceptionHandler(FlowableObjectNotFoundException.class) @ResponseBody - public ErrorInfo handleNotFound(FlowableObjectNotFoundException e) { + public ErrorInfo handleNotFound(FlowableObjectNotFoundException e, HttpServletRequest request) { + if (logger.isDebugEnabled()) { + logger.debug("Not found. Message: {}, Request: {} {}", e.getMessage(), request.getMethod(), request.getRequestURI()); + } return new ErrorInfo("Not found", e); } @ResponseStatus(HttpStatus.FORBIDDEN) // 403 @ExceptionHandler(FlowableForbiddenException.class) @ResponseBody - public ErrorInfo handleForbidden(FlowableForbiddenException e) { + public ErrorInfo handleForbidden(FlowableForbiddenException e, HttpServletRequest request) { + if (logger.isDebugEnabled()) { + logger.debug("Forbidden. Message: {}, Request: {} {}", e.getMessage(), request.getMethod(), request.getRequestURI()); + } return new ErrorInfo("Forbidden", e); } @ResponseStatus(HttpStatus.BAD_REQUEST) // 400 @ExceptionHandler(FlowableIllegalArgumentException.class) @ResponseBody - public ErrorInfo handleIllegalArgument(FlowableIllegalArgumentException e) { + public ErrorInfo handleIllegalArgument(FlowableIllegalArgumentException e, HttpServletRequest request) { + if (logger.isDebugEnabled()) { + logger.debug("Illegal argument. Message: {}, Request: {} {}", e.getMessage(), request.getMethod(), request.getRequestURI()); + } return new ErrorInfo("Bad request", e); } @ResponseStatus(HttpStatus.BAD_REQUEST) // 400 @ExceptionHandler(FlowableIllegalStateException.class) @ResponseBody - public ErrorInfo handleIllegalState(FlowableIllegalStateException e) { + public ErrorInfo handleIllegalState(FlowableIllegalStateException e, HttpServletRequest request) { + if (logger.isDebugEnabled()) { + logger.debug("Illegal state. Message: {}, Request: {} {}", e.getMessage(), request.getMethod(), request.getRequestURI()); + } return new ErrorInfo("Bad request", e); } @ResponseStatus(HttpStatus.BAD_REQUEST) // 400 @ExceptionHandler(HttpMessageConversionException.class) @ResponseBody - public ErrorInfo handleBadMessageConversion(HttpMessageConversionException e) { + public ErrorInfo handleBadMessageConversion(HttpMessageConversionException e, HttpServletRequest request) { if (sendFullErrorException) { + if (logger.isDebugEnabled()) { + logger.debug("Invalid message conversion. Message: {}, Request: {} {}", e.getMessage(), request.getMethod(), request.getRequestURI()); + } return new ErrorInfo("Bad request", e); } else { String errorIdentifier = UUID.randomUUID().toString(); - LOGGER.warn("Invalid Message conversion exception. Error ID: {}", errorIdentifier, e); + logger.warn("Invalid Message conversion exception. Error ID: {}. Message: {}, Request: {} {}", errorIdentifier, e.getMessage(), request.getMethod(), request.getRequestURI()); ErrorInfo errorInfo = new ErrorInfo("Bad request", null); errorInfo.setException("Invalid HTTP message. Error ID: " + errorIdentifier); return errorInfo; @@ -105,7 +128,10 @@ public ErrorInfo handleBadMessageConversion(HttpMessageConversionException e) { @ResponseStatus(HttpStatus.CONFLICT) // 409 @ExceptionHandler(FlowableTaskAlreadyClaimedException.class) @ResponseBody - public ErrorInfo handleTaskAlreadyClaimed(FlowableTaskAlreadyClaimedException e) { + public ErrorInfo handleTaskAlreadyClaimed(FlowableTaskAlreadyClaimedException e, HttpServletRequest request) { + if (logger.isDebugEnabled()) { + logger.debug("Task was already claimed. Message: {}, Request: {} {}", e.getMessage(), request.getMethod(), request.getRequestURI()); + } return new ErrorInfo("Task was already claimed", e); } @@ -114,14 +140,14 @@ public ErrorInfo handleTaskAlreadyClaimed(FlowableTaskAlreadyClaimedException e) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) // 500 @ExceptionHandler(Exception.class) @ResponseBody - public ErrorInfo handleOtherException(Exception e) { + public ErrorInfo handleOtherException(Exception e, HttpServletRequest request) { if (sendFullErrorException) { - LOGGER.error("Unhandled exception", e); + logger.error("Unhandled exception. Request: {} {}", request.getMethod(), request.getRequestURI(), e); return new ErrorInfo("Internal server error", e); } else { String errorIdentifier = UUID.randomUUID().toString(); - LOGGER.error("Unhandled exception. Error ID: {}", errorIdentifier, e); + logger.error("Unhandled exception. Error ID: {}. Request: {} {}", errorIdentifier, request.getMethod(), request.getRequestURI(), e); ErrorInfo errorInfo = new ErrorInfo("Internal server error", e); errorInfo.setException("Error with ID: " + errorIdentifier); return errorInfo; diff --git a/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/el/ELExecutionContextBuilder.java b/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/el/ELExecutionContextBuilder.java index ce727027244..5139c595751 100644 --- a/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/el/ELExecutionContextBuilder.java +++ b/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/el/ELExecutionContextBuilder.java @@ -115,28 +115,30 @@ protected static void preProcessInputVariables(DecisionTable decisionTable, Map< // check if transformation is needed for (Map.Entry inputVariable : inputVariables.entrySet()) { + String inputVariableName = inputVariable.getKey(); try { - if (inputVariable.getValue() instanceof LocalDate) { - Date transformedDate = ((LocalDate) inputVariable.getValue()).toDate(); - inputVariables.put(inputVariable.getKey(), transformedDate); - } else if (inputVariable.getValue() instanceof java.time.LocalDate) { - Date transformedDate = Date.from(((java.time.LocalDate) inputVariable.getValue()).atStartOfDay() + Object inputVariableValue = inputVariable.getValue(); + if (inputVariableValue instanceof LocalDate) { + Date transformedDate = ((LocalDate) inputVariableValue).toDate(); + inputVariables.put(inputVariableName, transformedDate); + } else if (inputVariableValue instanceof java.time.LocalDate) { + Date transformedDate = Date.from(((java.time.LocalDate) inputVariableValue).atStartOfDay() .atZone(ZoneId.systemDefault()) .toInstant()); - inputVariables.put(inputVariable.getKey(), transformedDate); - } else if (inputVariable.getValue() instanceof Long || inputVariable.getValue() instanceof Integer) { - BigInteger transformedNumber = new BigInteger(inputVariable.getValue().toString()); - inputVariables.put(inputVariable.getKey(), transformedNumber); - } else if (inputVariable.getValue() instanceof Double ) { - BigDecimal transformedNumber = new BigDecimal((Double) inputVariable.getValue()); - inputVariables.put(inputVariable.getKey(), transformedNumber); - } else if (inputVariable.getValue() instanceof Float) { - double doubleValue = Double.parseDouble(inputVariable.getValue().toString()); + inputVariables.put(inputVariableName, transformedDate); + } else if (inputVariableValue instanceof Long || inputVariableValue instanceof Integer) { + BigInteger transformedNumber = new BigInteger(inputVariableValue.toString()); + inputVariables.put(inputVariableName, transformedNumber); + } else if (inputVariableValue instanceof Double ) { + BigDecimal transformedNumber = new BigDecimal((Double) inputVariableValue); + inputVariables.put(inputVariableName, transformedNumber); + } else if (inputVariableValue instanceof Float) { + double doubleValue = Double.parseDouble(inputVariableValue.toString()); BigDecimal transformedNumber = new BigDecimal(doubleValue); - inputVariables.put(inputVariable.getKey(), transformedNumber); + inputVariables.put(inputVariableName, transformedNumber); } } catch (Exception ex) { - throw new FlowableException("error while transforming variable", ex); + throw new FlowableException("error while transforming input variable " + inputVariableName + " for decision table " + decisionTable.getId(), ex); } } } diff --git a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/FixedValue.java b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/FixedValue.java index 4dd8a947675..b950350c2de 100644 --- a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/FixedValue.java +++ b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/FixedValue.java @@ -38,7 +38,7 @@ public Object getValue(VariableContainer variableContainer) { @Override public void setValue(Object value, VariableContainer variableContainer) { - throw new FlowableException("Cannot change fixed value"); + throw new FlowableException("Cannot change fixed value with " + variableContainer); } @Override diff --git a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/JuelExpression.java b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/JuelExpression.java index 856b3c560ca..b3aa4e4b0d6 100644 --- a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/JuelExpression.java +++ b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/JuelExpression.java @@ -51,13 +51,13 @@ public Object getValue(VariableContainer variableContainer) { try { return resolveGetValueExpression(elContext); } catch (PropertyNotFoundException pnfe) { - throw new FlowableException("Unknown property used in expression: " + expressionText, pnfe); + throw new FlowableException("Unknown property used in expression: " + expressionText + " with " + variableContainer, pnfe); } catch (MethodNotFoundException mnfe) { - throw new FlowableException("Unknown method used in expression: " + expressionText, mnfe); + throw new FlowableException("Unknown method used in expression: " + expressionText + " with " + variableContainer, mnfe); } catch (FlowableException ex) { throw ex; } catch (Exception e) { - throw new FlowableException("Error while evaluating expression: " + expressionText, e); + throw new FlowableException("Error while evaluating expression: " + expressionText + " with " + variableContainer, e); } finally { elContext.putContext(EvaluationState.class, originalValueContext); elContext.putContext(VariableContainer.class, originalVariableContainer); @@ -79,7 +79,7 @@ public void setValue(Object value, VariableContainer variableContainer) { try { resolveSetValueExpression(value, elContext); } catch (Exception e) { - throw new FlowableException("Error while evaluating expression: " + expressionText, e); + throw new FlowableException("Error while evaluating expression: " + expressionText + " with " + variableContainer, e); } finally { elContext.putContext(EvaluationState.class, originalValueContext); elContext.putContext(VariableContainer.class, originalVariableContainer); diff --git a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/interceptor/CommandContextInterceptor.java b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/interceptor/CommandContextInterceptor.java index 1836a953049..a61c10dbd7d 100644 --- a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/interceptor/CommandContextInterceptor.java +++ b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/interceptor/CommandContextInterceptor.java @@ -135,7 +135,7 @@ public T execute(CommandConfig config, Command command, CommandExecutor c if (exception instanceof FlowableException) { throw (FlowableException) exception; } else { - throw new FlowableException("Exception during command execution", exception); + throw new FlowableException("Exception during execution of command " + command, exception); } } diff --git a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/scripting/DefaultScriptTrace.java b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/scripting/DefaultScriptTrace.java index f386a45bb44..e158bf2cd16 100644 --- a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/scripting/DefaultScriptTrace.java +++ b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/scripting/DefaultScriptTrace.java @@ -15,6 +15,7 @@ import java.time.Duration; import java.util.LinkedHashMap; import java.util.Map; +import java.util.StringJoiner; public class DefaultScriptTrace implements ScriptTrace, ScriptTraceEnhancer.ScriptTraceContext { @@ -62,4 +63,14 @@ public Map getTraceTags() { public Duration getDuration() { return duration; } + + @Override + public String toString() { + return new StringJoiner(", ", DefaultScriptTrace.class.getSimpleName() + "[", "]") + .add("duration=" + duration) + .add("request=" + request) + .add("exception=" + exception) + .add("traceTags=" + traceTags) + .toString(); + } } diff --git a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/scripting/ScriptEngineRequest.java b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/scripting/ScriptEngineRequest.java index 5770ba9a1e2..6eb3871b4bd 100644 --- a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/scripting/ScriptEngineRequest.java +++ b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/scripting/ScriptEngineRequest.java @@ -14,6 +14,7 @@ import java.util.LinkedList; import java.util.List; +import java.util.StringJoiner; import org.flowable.common.engine.api.FlowableIllegalStateException; import org.flowable.common.engine.api.variable.VariableContainer; @@ -183,4 +184,14 @@ public List getAdditionalResolvers() { public ScriptTraceEnhancer getTraceEnhancer() { return traceEnhancer; } + + @Override + public String toString() { + return new StringJoiner(", ", ScriptEngineRequest.class.getSimpleName() + "[", "]") + .add("language='" + language + "'") + .add("script='" + script + "'") + .add("variableContainer=" + variableContainer) + .add("storeScriptVariables=" + storeScriptVariables) + .toString(); + } } diff --git a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/scripting/ScriptingEngines.java b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/scripting/ScriptingEngines.java index 288458d694c..57206ad30cf 100644 --- a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/scripting/ScriptingEngines.java +++ b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/scripting/ScriptingEngines.java @@ -96,7 +96,7 @@ protected Object evaluate(ScriptEngine scriptEngine, ScriptEngineRequest request } catch (ScriptException e) { DefaultScriptTrace scriptTrace = DefaultScriptTrace.errorTrace(Duration.ofNanos(System.nanoTime() - startNanos), request, e); if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Caught exception evaluating script. {}{}{}", request.getLanguage(), System.lineSeparator(), + LOGGER.debug("Caught exception evaluating script for {}. {}{}{}", request.getVariableContainer(), request.getLanguage(), System.lineSeparator(), request.getScript()); } enhanceScriptTrace(request, scriptTrace); @@ -115,7 +115,7 @@ protected void notifyScriptTraceListener(ScriptTraceListener listener, ScriptTra try { listener.onScriptTrace(scriptTrace); } catch (Exception e) { - LOGGER.warn("Exception while executing scriptTraceListener: {}", e.getMessage(), e); + LOGGER.warn("Exception while executing scriptTraceListener: {} with {}", listener, scriptTrace, e); } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/delegate/DelegateHelper.java b/modules/flowable-engine/src/main/java/org/flowable/engine/delegate/DelegateHelper.java index ae742fc51ab..dbb44e6bd96 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/delegate/DelegateHelper.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/delegate/DelegateHelper.java @@ -60,7 +60,7 @@ public static void leaveDelegate(DelegateExecution delegateExecution, String seq delegateExecution.setCurrentFlowElement(flowElement); CommandContextUtil.getAgenda().planTakeOutgoingSequenceFlowsOperation((ExecutionEntity) delegateExecution, false); } else { - throw new FlowableException(sequenceFlowId + " does not match a sequence flow"); + throw new FlowableException(sequenceFlowId + " does not match a sequence flow for " + delegateExecution); } } @@ -81,7 +81,7 @@ public static FlowElement getFlowElement(DelegateExecution execution) { BpmnModel bpmnModel = getBpmnModel(execution); FlowElement flowElement = bpmnModel.getFlowElement(execution.getCurrentActivityId()); if (flowElement == null) { - throw new FlowableException("Could not find a FlowElement for activityId " + execution.getCurrentActivityId()); + throw new FlowableException("Could not find a FlowElement for activityId " + execution.getCurrentActivityId() + " in " + execution); } return flowElement; } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/agenda/ContinueProcessOperation.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/agenda/ContinueProcessOperation.java index 9faaaf8d151..b97b9fa9ac3 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/agenda/ContinueProcessOperation.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/agenda/ContinueProcessOperation.java @@ -89,7 +89,7 @@ public void run() { } else if (currentFlowElement instanceof SequenceFlow) { continueThroughSequenceFlow((SequenceFlow) currentFlowElement); } else { - throw new FlowableException("Programmatic error: no current flow element found or invalid type: " + currentFlowElement + ". Halting."); + throw new FlowableException("Programmatic error: no current flow element found or invalid type: " + currentFlowElement + ". For " + execution + ". Halting."); } } @@ -233,7 +233,7 @@ protected void executeMultiInstanceSynchronous(FlowNode flowNode) { } } else { - throw new FlowableException("Expected an activity behavior in flow node " + flowNode.getId()); + throw new FlowableException("Expected an activity behavior in flow node " + flowNode.getId() + " for " + execution); } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/agenda/DestroyScopeOperation.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/agenda/DestroyScopeOperation.java index baff7e34d81..5b069e9612b 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/agenda/DestroyScopeOperation.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/agenda/DestroyScopeOperation.java @@ -41,7 +41,7 @@ public void run() { ExecutionEntity scopeExecution = execution.isScope() ? execution : findFirstParentScopeExecution(execution); if (scopeExecution == null) { - throw new FlowableException("Programmatic error: no parent scope execution found for boundary event"); + throw new FlowableException("Programmatic error: no parent scope execution found for boundary event for " + execution); } ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(commandContext); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/agenda/TakeOutgoingSequenceFlowsOperation.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/agenda/TakeOutgoingSequenceFlowsOperation.java index 5dd036922f4..5d378b0c6ac 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/agenda/TakeOutgoingSequenceFlowsOperation.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/agenda/TakeOutgoingSequenceFlowsOperation.java @@ -108,7 +108,7 @@ public void run() { handleSequenceFlow(); } else { - throw new FlowableException("Programmatic error: this operation needs either a FlowNode or a SequenceFlow as current FlowElement"); + throw new FlowableException("Programmatic error: this operation needs either a FlowNode or a SequenceFlow as current FlowElement for " + execution); } } @@ -248,7 +248,7 @@ protected void leaveFlowNode(FlowNode flowNode) { agenda.planEndExecutionOperation(execution); } else { - throw new FlowableException("No outgoing sequence flow of element '" + flowNode.getId() + "' could be selected for continuing the process"); + throw new FlowableException("No outgoing sequence flow of element '" + flowNode.getId() + "' could be selected for continuing the process for " + execution); } } else { diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/agenda/TriggerExecutionOperation.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/agenda/TriggerExecutionOperation.java index d9de640e244..2142acc7ad8 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/agenda/TriggerExecutionOperation.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/agenda/TriggerExecutionOperation.java @@ -69,19 +69,19 @@ public void run() { } else { - throw new FlowableException("Cannot trigger execution with id " + execution.getId() + throw new FlowableException("Cannot trigger " + execution + " : the activityBehavior " + activityBehavior.getClass() + " does not implement the " + TriggerableActivityBehavior.class.getName() + " interface"); } } else if (currentFlowElement == null) { - throw new FlowableException("Cannot trigger execution with id " + execution.getId() + throw new FlowableException("Cannot trigger " + execution + " : no current flow element found. Check the execution id that is being passed " + "(it should not be a process instance execution, but a child execution currently referencing a flow element)."); } else { - throw new FlowableException("Programmatic error: cannot trigger execution, invalid flowelement type found: " + throw new FlowableException("Programmatic error: cannot trigger " + execution + ", invalid flow element type found: " + currentFlowElement.getClass().getName() + "."); } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/AdhocSubProcessActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/AdhocSubProcessActivityBehavior.java index 686ab9a91d8..8abae93019f 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/AdhocSubProcessActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/AdhocSubProcessActivityBehavior.java @@ -50,7 +50,9 @@ protected SubProcess getSubProcessFromExecution(DelegateExecution execution) { if (flowElement instanceof SubProcess) { subProcess = (SubProcess) flowElement; } else { - throw new FlowableException("Programmatic error: sub process behaviour can only be applied" + " to a SubProcess instance, but got an instance of " + flowElement); + throw new FlowableException( + "Programmatic error: sub process behaviour can only be applied to a SubProcess instance, but got an instance of " + flowElement + " for " + + execution); } return subProcess; } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryCancelEventActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryCancelEventActivityBehavior.java index 99cfbe57c62..db14e88081f 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryCancelEventActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryCancelEventActivityBehavior.java @@ -57,7 +57,7 @@ public void trigger(DelegateExecution execution, String triggerName, Object trig } if (subProcessExecution == null) { - throw new FlowableException("No execution found for sub process of boundary cancel event " + boundaryEvent.getId()); + throw new FlowableException("No execution found for sub process of boundary cancel event " + boundaryEvent.getId() + " for " + execution); } EventSubscriptionService eventSubscriptionService = processEngineConfiguration.getEventSubscriptionServiceConfiguration().getEventSubscriptionService(); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryCompensateEventActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryCompensateEventActivityBehavior.java index 2e21e4e1ad6..6431b71324b 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryCompensateEventActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryCompensateEventActivityBehavior.java @@ -53,7 +53,7 @@ public void execute(DelegateExecution execution) { Process process = ProcessDefinitionUtil.getProcess(execution.getProcessDefinitionId()); if (process == null) { - throw new FlowableException("Process model (id = " + execution.getId() + ") could not be found"); + throw new FlowableException("Process model for " + executionEntity + " could not be found"); } Activity sourceActivity = null; @@ -72,11 +72,11 @@ public void execute(DelegateExecution execution) { } if (sourceActivity == null) { - throw new FlowableException("Parent activity for boundary compensation event could not be found"); + throw new FlowableException("Parent activity for boundary compensation event could not be found for " + executionEntity); } if (compensationActivity == null) { - throw new FlowableException("Compensation activity could not be found (or it is missing 'isForCompensation=\"true\"'"); + throw new FlowableException("Compensation activity could not be found (or it is missing 'isForCompensation=\"true\"') for " + executionEntity); } // find SubProcess or Process instance execution @@ -94,7 +94,7 @@ public void execute(DelegateExecution execution) { } if (scopeExecution == null) { - throw new FlowableException("Could not find a scope execution for compensation boundary event " + boundaryEvent.getId()); + throw new FlowableException("Could not find a scope execution for compensation boundary event " + boundaryEvent.getId() + " for " + executionEntity); } ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryEventActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryEventActivityBehavior.java index e2b939862b5..2452652f40f 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryEventActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryEventActivityBehavior.java @@ -82,7 +82,7 @@ protected void executeInterruptingBehavior(ExecutionEntity executionEntity, Comm } if (parentScopeExecution == null) { - throw new FlowableException("Programmatic error: no parent scope execution found for boundary event"); + throw new FlowableException("Programmatic error: no parent scope execution found for boundary event for " + executionEntity); } if (attachedRefScopeExecution.getCurrentFlowElement() instanceof FlowNode) { @@ -136,7 +136,7 @@ protected void executeNonInterruptingBehavior(ExecutionEntity executionEntity, C } if (scopeExecution == null) { - throw new FlowableException("Programmatic error: no parent scope execution found for boundary event"); + throw new FlowableException("Programmatic error: no parent scope execution found for boundary event for " + executionEntity); } CommandContextUtil.getActivityInstanceEntityManager(commandContext).recordActivityEnd(executionEntity, null); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryEventRegistryEventActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryEventRegistryEventActivityBehavior.java index a9421d481fa..6845186d3c6 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryEventRegistryEventActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryEventRegistryEventActivityBehavior.java @@ -109,7 +109,7 @@ protected String getEventDefinitionKey(ExecutionEntity executionEntity, ProcessE } if (key == null) { - throw new FlowableException("Could not resolve key for: " + eventDefinitionKey); + throw new FlowableException("Could not resolve key for: " + eventDefinitionKey + " in " + executionEntity); } return key.toString(); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryTimerEventActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryTimerEventActivityBehavior.java index 1c3c018be28..4cc701f666a 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryTimerEventActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryTimerEventActivityBehavior.java @@ -42,7 +42,7 @@ public void execute(DelegateExecution execution) { ExecutionEntity executionEntity = (ExecutionEntity) execution; if (!(execution.getCurrentFlowElement() instanceof BoundaryEvent)) { - throw new FlowableException("Programmatic error: " + this.getClass() + " should not be used for anything else than a boundary event"); + throw new FlowableException("Programmatic error: " + this.getClass() + " should not be used for anything else than a boundary event for " + executionEntity); } TimerJobEntity timerJob = TimerUtil.createTimerEntityForTimerEventDefinition(timerEventDefinition, execution.getCurrentFlowElement(), diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/CallActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/CallActivityBehavior.java index da38d2cc54f..93923127775 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/CallActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/CallActivityBehavior.java @@ -249,7 +249,7 @@ protected ProcessDefinition getProcessDefinition(DelegateExecution execution, Ca processDefinition = getProcessDefinitionByKey(execution, callActivity.isSameDeployment(), processEngineConfiguration); break; default: - throw new FlowableException("Unrecognized calledElementType [" + calledElementType + "]"); + throw new FlowableException("Unrecognized calledElementType [" + calledElementType + "] in " + execution); } return processDefinition; } @@ -284,7 +284,7 @@ public void completed(DelegateExecution execution) throws Exception { ExecutionEntity executionEntity = (ExecutionEntity) execution; if (executionEntity.isSuspended() || ProcessDefinitionUtil.isProcessDefinitionSuspended(execution.getProcessDefinitionId())) { - throw new FlowableException("Cannot complete process instance. Parent process instance " + executionEntity.getId() + " is suspended"); + throw new FlowableException("Cannot complete process instance. Parent process instance " + executionEntity + " is suspended"); } leave(execution); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/CancelEndEventActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/CancelEndEventActivityBehavior.java index 8637e7dc369..1d9018cb37d 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/CancelEndEventActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/CancelEndEventActivityBehavior.java @@ -67,7 +67,7 @@ public void execute(DelegateExecution execution) { } if (parentScopeExecution == null) { - throw new FlowableException("No sub process execution found for cancel end event " + executionEntity.getCurrentActivityId()); + throw new FlowableException("No sub process execution found for cancel end event in " + executionEntity); } SubProcess subProcess = (SubProcess) parentScopeExecution.getCurrentFlowElement(); @@ -84,7 +84,7 @@ public void execute(DelegateExecution execution) { } if (cancelBoundaryEvent == null) { - throw new FlowableException("Could not find cancel boundary event for cancel end event " + executionEntity.getCurrentActivityId()); + throw new FlowableException("Could not find cancel boundary event for cancel end event in " + executionEntity); } ExecutionEntity newParentScopeExecution = null; @@ -98,7 +98,7 @@ public void execute(DelegateExecution execution) { } if (newParentScopeExecution == null) { - throw new FlowableException("Programmatic error: no parent scope execution found for boundary event " + cancelBoundaryEvent.getId()); + throw new FlowableException("Programmatic error: no parent scope execution found for boundary event " + cancelBoundaryEvent.getId() + " for " + parentScopeExecution); } ScopeUtil.createCopyOfSubProcessExecutionForCompensation(parentScopeExecution); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/CaseTaskActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/CaseTaskActivityBehavior.java index d4abc8ae445..00be9918375 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/CaseTaskActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/CaseTaskActivityBehavior.java @@ -147,7 +147,7 @@ public void triggerCaseTask(DelegateExecution execution, Map var ExecutionEntity executionEntity = (ExecutionEntity) execution; if (executionEntity.isSuspended() || ProcessDefinitionUtil.isProcessDefinitionSuspended(execution.getProcessDefinitionId())) { - throw new FlowableException("Cannot complete case task. Parent process instance " + executionEntity.getId() + " is suspended"); + throw new FlowableException("Cannot complete case task. Parent process instance " + executionEntity + " is suspended"); } // Set the reference id and type to null since the execution could be reused diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/DmnActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/DmnActivityBehavior.java index e2a81936de6..020e7503209 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/DmnActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/DmnActivityBehavior.java @@ -61,7 +61,7 @@ public void execute(DelegateExecution execution) { if (fieldExtension == null || ((fieldExtension.getStringValue() == null || fieldExtension.getStringValue().length() == 0) && (fieldExtension.getExpression() == null || fieldExtension.getExpression().length() == 0))) { - throw new FlowableException("decisionTableReferenceKey is a required field extension for the dmn task " + task.getId()); + throw new FlowableException("decisionTableReferenceKey is a required field extension for the dmn task " + task.getId() + " in " + execution); } String activeDecisionKey = null; @@ -110,7 +110,7 @@ public void execute(DelegateExecution execution) { DecisionExecutionAuditContainer decisionExecutionAuditContainer = executeDecisionBuilder.executeWithAuditTrail(); if (decisionExecutionAuditContainer.isFailed()) { - throw new FlowableException("DMN decision with key " + finalDecisionKeyValue + " execution failed. Cause: " + decisionExecutionAuditContainer.getExceptionMessage()); + throw new FlowableException("DMN decision with key " + finalDecisionKeyValue + " execution failed. Cause: " + decisionExecutionAuditContainer.getExceptionMessage() + " in " + execution); } /*Throw error if there were no rules hit when the flag indicates to do this.*/ @@ -126,14 +126,14 @@ public void execute(DelegateExecution execution) { if (decisionExecutionAuditContainer.getDecisionResult().isEmpty() && throwErrorString != null) { if ("true".equalsIgnoreCase(throwErrorString)) { - throw new FlowableException("DMN decision with key " + finalDecisionKeyValue + " did not hit any rules for the provided input."); + throw new FlowableException("DMN decision with key " + finalDecisionKeyValue + " did not hit any rules for the provided input. In " + execution); } else if (!"false".equalsIgnoreCase(throwErrorString)) { Expression expression = expressionManager.createExpression(throwErrorString); Object expressionValue = expression.getValue(execution); if (expressionValue instanceof Boolean && ((Boolean) expressionValue)) { - throw new FlowableException("DMN decision with key " + finalDecisionKeyValue + " did not hit any rules for the provided input."); + throw new FlowableException("DMN decision with key " + finalDecisionKeyValue + " did not hit any rules for the provided input. In " + execution); } } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ExclusiveGatewayActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ExclusiveGatewayActivityBehavior.java index 75bd03ea6db..f7477c01bc1 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ExclusiveGatewayActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ExclusiveGatewayActivityBehavior.java @@ -110,7 +110,7 @@ public void leave(DelegateExecution execution) { } else { // No sequence flow could be found, not even a default one - throw new FlowableException("No outgoing sequence flow of the exclusive gateway '" + exclusiveGateway.getId() + "' could be selected for continuing the process"); + throw new FlowableException("No outgoing sequence flow of the exclusive gateway '" + exclusiveGateway.getId() + "' could be selected for continuing " + execution); } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ExternalWorkerTaskActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ExternalWorkerTaskActivityBehavior.java index 5dee927dffe..b802d3930f5 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ExternalWorkerTaskActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ExternalWorkerTaskActivityBehavior.java @@ -120,7 +120,7 @@ public void execute(DelegateExecution execution) { if (topicValue != null && !topicValue.toString().isEmpty()) { job.setJobHandlerConfiguration(topicValue.toString()); } else { - throw new FlowableException("Expression " + jobTopicExpression + " did not evaluate to a valid value (non empty String). Was: " + topicValue); + throw new FlowableException("Expression " + jobTopicExpression + " did not evaluate to a valid value (non empty String). Was: " + topicValue + ". For " + execution); } jobService.insertExternalWorkerJob(job); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/FlowNodeActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/FlowNodeActivityBehavior.java index 8a96a32722b..3d04b13391b 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/FlowNodeActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/FlowNodeActivityBehavior.java @@ -53,7 +53,7 @@ public void leaveIgnoreConditions(DelegateExecution execution) { @Override public void trigger(DelegateExecution execution, String signalName, Object signalData) { // concrete activity behaviours that do accept signals should override this method; - throw new FlowableException("this activity isn't waiting for a trigger"); + throw new FlowableException("this activity isn't waiting for a trigger for " + execution); } protected String parseActivityType(FlowNode flowNode) { diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/IntermediateCatchEventRegistryEventActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/IntermediateCatchEventRegistryEventActivityBehavior.java index d5c7a813e3a..90a2f2f6c89 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/IntermediateCatchEventRegistryEventActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/IntermediateCatchEventRegistryEventActivityBehavior.java @@ -82,7 +82,7 @@ protected String getEventDefinitionKey(CommandContext commandContext, ExecutionE } if (key == null) { - throw new FlowableException("Could not resolve key for: " + eventDefinitionKey); + throw new FlowableException("Could not resolve key for: " + eventDefinitionKey + " in " + executionEntity); } return key.toString(); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/IntermediateThrowCompensationEventActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/IntermediateThrowCompensationEventActivityBehavior.java index 24518a07460..4f161f14d8e 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/IntermediateThrowCompensationEventActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/IntermediateThrowCompensationEventActivityBehavior.java @@ -81,7 +81,7 @@ public void execute(DelegateExecution execution) { String processDefinitionId = execution.getProcessDefinitionId(); Process process = ProcessDefinitionUtil.getProcess(processDefinitionId); if (process == null) { - throw new FlowableException("Process model (id = " + processDefinitionId + ") could not be found"); + throw new FlowableException("Process model (id = " + processDefinitionId + ") could not be found for " + execution); } String compensationActivityId = null; diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ParallelGatewayActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ParallelGatewayActivityBehavior.java index ed2c656c030..9dcf5630776 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ParallelGatewayActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ParallelGatewayActivityBehavior.java @@ -64,7 +64,9 @@ public void execute(DelegateExecution execution) { if (flowElement instanceof ParallelGateway) { parallelGateway = (ParallelGateway) flowElement; } else { - throw new FlowableException("Programmatic error: parallel gateway behaviour can only be applied" + " to a ParallelGateway instance, but got an instance of " + flowElement); + throw new FlowableException( + "Programmatic error: parallel gateway behaviour can only be applied to a ParallelGateway instance, but got an instance of " + flowElement + + " for " + execution); } lockFirstParentScope(execution); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ReceiveEventTaskActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ReceiveEventTaskActivityBehavior.java index 5a321aca0f4..51bc8c87c47 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ReceiveEventTaskActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ReceiveEventTaskActivityBehavior.java @@ -104,7 +104,7 @@ protected String getEventDefinitionKey(CommandContext commandContext, ExecutionE } if (key == null) { - throw new FlowableException("Could not resolve key for: " + eventDefinitionKey); + throw new FlowableException("Could not resolve key for: " + eventDefinitionKey + " for " + executionEntity); } return key.toString(); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ScriptTaskActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ScriptTaskActivityBehavior.java index 4198f2f9e82..d753b91edcf 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ScriptTaskActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ScriptTaskActivityBehavior.java @@ -93,7 +93,7 @@ protected void safelyExecuteScript(DelegateExecution execution) { try { executeScript(execution); } catch (FlowableException e) { - LOGGER.warn("Exception while executing {} : {}", execution.getCurrentFlowElement().getId(), e.getMessage()); + LOGGER.warn("Exception while executing {} : {}", execution, e.getMessage()); noErrors = false; Throwable rootCause = ExceptionUtils.getRootCause(e); @@ -122,8 +122,7 @@ protected void executeScript(DelegateExecution execution) { if (null != result) { if ("juel".equalsIgnoreCase(language) && (result instanceof String) && script.equals(result.toString())) { - throw new FlowableException(String.format("Error evaluating juel script: \"%s\" of activity id: %s of process definition id: %s", - script, execution.getCurrentActivityId(), execution.getProcessDefinitionId())); + throw new FlowableException("Error evaluating juel script: \"" + script + "\" for " + execution); } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/SendEventTaskActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/SendEventTaskActivityBehavior.java index f0b7e7a0a0e..63997d79c36 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/SendEventTaskActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/SendEventTaskActivityBehavior.java @@ -147,7 +147,7 @@ protected EventModel getEventModel(CommandContext commandContext, DelegateExecut } if (eventModel == null) { - throw new FlowableException("No event definition found for event key " + sendEventServiceTask.getEventType()); + throw new FlowableException("No event definition found for event key " + sendEventServiceTask.getEventType() + " for " + execution); } return eventModel; } @@ -193,7 +193,7 @@ protected List getChannelModels(CommandContext commandContext, Del if (channelKeys.isEmpty()) { if (!sendOnSystemChannel) { // If the event is going to be send on the system channel then it is allowed to not define any other channels - throw new FlowableException("No channel keys configured"); + throw new FlowableException("No channel keys configured for " + execution); } else { return Collections.emptyList(); } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/SequentialMultiInstanceBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/SequentialMultiInstanceBehavior.java index ff292501a9c..37f14b96be2 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/SequentialMultiInstanceBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/SequentialMultiInstanceBehavior.java @@ -128,7 +128,7 @@ public void continueSequentialMultiInstance(DelegateExecution execution, int loo // Intermediate Event or Error Event Sub-Process in the process throw error; } catch (Exception e) { - throw new FlowableException("Could not execute inner activity behavior of multi instance behavior", e); + throw new FlowableException("Could not execute inner activity behavior of multi instance behavior for " + execution, e); } } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ShellActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ShellActivityBehavior.java index 4fdcf4b560a..c6587262f89 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ShellActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/ShellActivityBehavior.java @@ -134,7 +134,7 @@ public void execute(DelegateExecution execution) { } } catch (Exception e) { - throw new FlowableException("Could not execute shell command ", e); + throw new FlowableException("Could not execute shell command for " + execution, e); } leave(execution); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/SubProcessActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/SubProcessActivityBehavior.java index 112e12529fa..d372a0bcc86 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/SubProcessActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/SubProcessActivityBehavior.java @@ -53,7 +53,7 @@ public void execute(DelegateExecution execution) { FlowElement startElement = getStartElement(subProcess); if (startElement == null) { - throw new FlowableException("No initial activity found for subprocess " + subProcess.getId()); + throw new FlowableException("No initial activity found for subprocess " + subProcess.getId() + " in " + execution); } ExecutionEntity executionEntity = (ExecutionEntity) execution; @@ -101,7 +101,9 @@ protected SubProcess getSubProcessFromExecution(DelegateExecution execution) { if (flowElement instanceof SubProcess) { subProcess = (SubProcess) flowElement; } else { - throw new FlowableException("Programmatic error: sub process behaviour can only be applied" + " to a SubProcess instance, but got an instance of " + flowElement); + throw new FlowableException( + "Programmatic error: sub process behaviour can only be applied to a SubProcess instance, but got an instance of " + flowElement + " for " + + execution); } return subProcess; } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/UserTaskActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/UserTaskActivityBehavior.java index 90fefbec8fc..75d0f24e5c3 100755 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/UserTaskActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/UserTaskActivityBehavior.java @@ -319,7 +319,7 @@ public void trigger(DelegateExecution execution, String signalName, Object signa .findTasksByExecutionId(execution.getId()); // Should be only one for (TaskEntity taskEntity : taskEntities) { if (!taskEntity.isDeleted()) { - throw new FlowableException("UserTask should not be signalled before complete"); + throw new FlowableException("UserTask should not be signalled before complete for " + taskEntity); } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/WebServiceActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/WebServiceActivityBehavior.java index 6c110c27b73..f7b353df30e 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/WebServiceActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/WebServiceActivityBehavior.java @@ -107,7 +107,7 @@ public void execute(DelegateExecution execution) { dataOutputAssociations = serviceTask.getDataOutputAssociations(); } else { - throw new FlowableException("Unsupported flow element type " + flowElement); + throw new FlowableException("Unsupported flow element type " + flowElement + " in " + execution); } MessageInstance message = null; diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/deployer/EventSubscriptionManager.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/deployer/EventSubscriptionManager.java index 21d41e3c269..eba0e399bd2 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/deployer/EventSubscriptionManager.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/deployer/EventSubscriptionManager.java @@ -178,7 +178,7 @@ protected void insertMessageEvent(MessageEventDefinition messageEventDefinition, if (eventSubscriptionEntity.getProcessInstanceId() == null || eventSubscriptionEntity.getProcessInstanceId().isEmpty()) { // processInstanceId != null or not empty -> it's a message related to an execution // the event subscription has no instance-id, so it's a message start event throw new FlowableException("Cannot deploy process definition '" + processDefinition.getResourceName() - + "': there already is a message event subscription for the message with name '" + messageName + "'."); + + "': there already is a message event subscription for the message with name '" + messageName + "'. For " + eventSubscriptionEntity); } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/helper/ClassDelegate.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/helper/ClassDelegate.java index b24cc9cab25..16b40fbacb4 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/helper/ClassDelegate.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/helper/ClassDelegate.java @@ -222,7 +222,7 @@ public void trigger(DelegateExecution execution, String signalName, Object signa } } } else { - throw new FlowableException("signal() can only be called on a " + TriggerableActivityBehavior.class.getName() + " instance"); + throw new FlowableException("signal() can only be called on a " + TriggerableActivityBehavior.class.getName() + " instance for " + execution); } } @@ -237,7 +237,7 @@ public void completing(DelegateExecution execution, DelegateExecution subProcess if (activityBehaviorInstance instanceof SubProcessActivityBehavior) { ((SubProcessActivityBehavior) activityBehaviorInstance).completing(execution, subProcessInstance); } else { - throw new FlowableException("completing() can only be called on a " + SubProcessActivityBehavior.class.getName() + " instance"); + throw new FlowableException("completing() can only be called on a " + SubProcessActivityBehavior.class.getName() + " instance for " + execution); } } @@ -250,7 +250,7 @@ public void completed(DelegateExecution execution) throws Exception { if (activityBehaviorInstance instanceof SubProcessActivityBehavior) { ((SubProcessActivityBehavior) activityBehaviorInstance).completed(execution); } else { - throw new FlowableException("completed() can only be called on a " + SubProcessActivityBehavior.class.getName() + " instance"); + throw new FlowableException("completed() can only be called on a " + SubProcessActivityBehavior.class.getName() + " instance for " + execution); } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/helper/ErrorPropagation.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/helper/ErrorPropagation.java index 90d1b02af43..5217d9a4afb 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/helper/ErrorPropagation.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/helper/ErrorPropagation.java @@ -224,7 +224,7 @@ protected static void executeCatch(Map> eventMap, DelegateEx executeEventHandler(matchingEvent, parentExecution, currentExecution, errorVariableContainer); } else { - throw new FlowableException("No matching parent execution for error code " + errorId + " found"); + throw new FlowableException("No matching parent execution for error code " + errorId + " found for " + delegateExecution); } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/helper/ErrorThrowingEventListener.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/helper/ErrorThrowingEventListener.java index 87ae6ac019a..52977637f85 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/helper/ErrorThrowingEventListener.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/helper/ErrorThrowingEventListener.java @@ -56,13 +56,13 @@ public void onEvent(FlowableEvent event) { } if (execution == null) { - throw new FlowableException("No execution context active and event is not related to an execution. No compensation event can be thrown."); + throw new FlowableException("No execution context active and event (" + event + ") is not related to an execution. No compensation event can be thrown."); } try { ErrorPropagation.propagateError(errorCode, execution); } catch (Exception e) { - throw new FlowableException("Error while propagating error-event", e); + throw new FlowableException("Error while propagating error-event for " + execution, e); } } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/helper/EscalationPropagation.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/helper/EscalationPropagation.java index ce8613fdced..a4624b37194 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/helper/EscalationPropagation.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/helper/EscalationPropagation.java @@ -13,8 +13,6 @@ package org.flowable.engine.impl.bpmn.helper; -import static java.lang.String.format; - import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -216,9 +214,9 @@ protected static void executeEventHandler(Event event, ExecutionEntity parentExe } if (boundaryExecution != null && boundaryExecution.isSuspended()) { - String errorMessage = format("Cannot propagate escalation '%s' with code '%s', because execution '%s' is suspended.", - escalationName, escalationCode, boundaryExecution.getId()); - throw new FlowableException(errorMessage); + throw new FlowableException( + "Cannot propagate escalation '" + escalationName + "' with code '" + escalationCode + "', because " + boundaryExecution + + " is suspended"); } CommandContextUtil.getAgenda().planTriggerExecutionOperation(boundaryExecution); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/http/DefaultBpmnHttpActivityDelegate.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/http/DefaultBpmnHttpActivityDelegate.java index 3eeb547aed4..a5c8ecc0237 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/http/DefaultBpmnHttpActivityDelegate.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/http/DefaultBpmnHttpActivityDelegate.java @@ -86,7 +86,7 @@ public CompletableFuture execute(DelegateExecution execution, Asy if (e instanceof FlowableException) { throw (FlowableException) e; } else { - throw new FlowableException(HTTP_TASK_REQUEST_FIELD_INVALID + " in execution " + execution.getId(), e); + throw new FlowableException(HTTP_TASK_REQUEST_FIELD_INVALID + " in execution " + execution, e); } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cfg/DefaultInternalJobManager.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cfg/DefaultInternalJobManager.java index 8fdb45a32c1..62a8ef0ac08 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cfg/DefaultInternalJobManager.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cfg/DefaultInternalJobManager.java @@ -219,7 +219,7 @@ protected void preTimerJobDeleteInternal(JobEntity jobEntity, VariableScope vari jobEntity.setEndDate((Date) endDateValue); } else { throw new FlowableException("Timer '" + ((ExecutionEntity) variableScope).getActivityId() - + "' was not configured with a valid duration/time, either hand in a java.util.Date or a String in format 'yyyy-MM-dd'T'hh:mm:ss'"); + + "' in " + variableScope + " was not configured with a valid duration/time, either hand in a java.util.Date or a String in format 'yyyy-MM-dd'T'hh:mm:ss'"); } if (jobEntity.getEndDate() == null) { diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AbstractExternalWorkerJobCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AbstractExternalWorkerJobCmd.java index bb7b19f5f77..3f213a0d673 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AbstractExternalWorkerJobCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AbstractExternalWorkerJobCmd.java @@ -47,8 +47,7 @@ protected AbstractExternalWorkerJobCmd(String externalJobId, String workerId, Jo public final Void execute(CommandContext commandContext) { ExternalWorkerJobEntity externalWorkerJob = resolveJob(commandContext); if (externalWorkerJob.getProcessInstanceId() == null) { - throw new FlowableException( - "External worker job with id " + externalJobId + " is not bpmn scoped. This command can only handle bpmn scoped external worker jobs"); + throw new FlowableException(externalWorkerJob + " is not bpmn scoped. This command can only handle bpmn scoped external worker jobs"); } runJobLogic(externalWorkerJob, commandContext); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AbstractSetProcessDefinitionStateCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AbstractSetProcessDefinitionStateCmd.java index ab768fef09b..af45010c856 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AbstractSetProcessDefinitionStateCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AbstractSetProcessDefinitionStateCmd.java @@ -136,7 +136,7 @@ protected List findProcessDefinition(CommandContext com List processDefinitions = query.list(); if (processDefinitions.isEmpty()) { - throw new FlowableException("Cannot find process definition for key '" + processDefinitionKey + "'"); + throw new FlowableException("Cannot find process definition for key '" + processDefinitionKey + "' and tenant '" + tenantId + "'"); } for (ProcessDefinition processDefinition : processDefinitions) { diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AbstractSetProcessInstanceStateCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AbstractSetProcessInstanceStateCmd.java index c0d292c7923..76684499f90 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AbstractSetProcessInstanceStateCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AbstractSetProcessInstanceStateCmd.java @@ -64,7 +64,7 @@ public Void execute(CommandContext commandContext) { throw new FlowableObjectNotFoundException("Cannot find processInstance for id '" + processInstanceId + "'.", Execution.class); } if (!executionEntity.isProcessInstanceType()) { - throw new FlowableException("Cannot set suspension state for execution '" + processInstanceId + "': not a process instance."); + throw new FlowableException("Cannot set suspension state for execution '" + executionEntity + "': not a process instance."); } if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, executionEntity.getProcessDefinitionId())) { diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ActivateTaskCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ActivateTaskCmd.java index ba505a2aeab..ee8dfae4e9c 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ActivateTaskCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ActivateTaskCmd.java @@ -52,11 +52,11 @@ public Void execute(CommandContext commandContext) { } if (task.isDeleted()) { - throw new FlowableException("Task " + taskId + " is already deleted"); + throw new FlowableException(task + " is already deleted"); } if (!task.isSuspended()) { - throw new FlowableException("Task " + taskId + " is not suspended, so can't be activated"); + throw new FlowableException(task + " is not suspended, so can't be activated"); } Clock clock = processEngineConfiguration.getClock(); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AddCommentCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AddCommentCmd.java index 6f8af3ee0d1..0d139399adb 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AddCommentCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AddCommentCmd.java @@ -66,7 +66,7 @@ public Comment execute(CommandContext commandContext) { } if (task.isSuspended()) { - throw new FlowableException(getSuspendedTaskException()); + throw new FlowableException("Cannot add a comment to a suspended " + task); } } @@ -79,7 +79,7 @@ public Comment execute(CommandContext commandContext) { } if (execution.isSuspended()) { - throw new FlowableException(getSuspendedExceptionMessage()); + throw new FlowableException("Cannot add a comment to a suspended " + execution); } } @@ -116,12 +116,4 @@ public Comment execute(CommandContext commandContext) { return comment; } - - protected String getSuspendedTaskException() { - return "Cannot add a comment to a suspended task"; - } - - protected String getSuspendedExceptionMessage() { - return "Cannot add a comment to a suspended execution"; - } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AddMultiInstanceExecutionCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AddMultiInstanceExecutionCmd.java index 3c41837c748..f239a523d7c 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AddMultiInstanceExecutionCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AddMultiInstanceExecutionCmd.java @@ -94,7 +94,7 @@ protected ExecutionEntity searchForMultiInstanceActivity(String activityId, Stri for (ExecutionEntity childExecution : childExecutions) { if (activityId.equals(childExecution.getActivityId()) && childExecution.isMultiInstanceRoot()) { if (miExecution != null) { - throw new FlowableException("Multiple multi instance executions found for activity id " + activityId); + throw new FlowableException("Multiple multi instance executions found for activity id " + activityId + " in " + childExecution); } miExecution = childExecution; } @@ -102,7 +102,7 @@ protected ExecutionEntity searchForMultiInstanceActivity(String activityId, Stri ExecutionEntity childMiExecution = searchForMultiInstanceActivity(activityId, childExecution.getId(), executionEntityManager); if (childMiExecution != null) { if (miExecution != null) { - throw new FlowableException("Multiple multi instance executions found for activity id " + activityId); + throw new FlowableException("Multiple multi instance executions found for activity id " + activityId + " in " + childExecution); } miExecution = childMiExecution; } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ClaimTaskCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ClaimTaskCmd.java index ba7069d100f..4155146a430 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ClaimTaskCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ClaimTaskCmd.java @@ -100,8 +100,8 @@ protected Void execute(CommandContext commandContext, TaskEntity task) { } @Override - protected String getSuspendedTaskException() { - return "Cannot claim a suspended task"; + protected String getSuspendedTaskExceptionPrefix() { + return "Cannot claim"; } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/CompleteAdhocSubProcessCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/CompleteAdhocSubProcessCmd.java index f60085a9aed..ee70ceee044 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/CompleteAdhocSubProcessCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/CompleteAdhocSubProcessCmd.java @@ -47,12 +47,12 @@ public Void execute(CommandContext commandContext) { } if (!(execution.getCurrentFlowElement() instanceof AdhocSubProcess)) { - throw new FlowableException("The current flow element of the requested execution is not an ad-hoc sub process"); + throw new FlowableException("The current flow element of the requested " + execution + " is not an ad-hoc sub process"); } List childExecutions = execution.getExecutions(); if (childExecutions.size() > 0) { - throw new FlowableException("Ad-hoc sub process has running child executions that need to be completed first"); + throw new FlowableException("Ad-hoc sub process has running child executions that need to be completed first. " + execution); } ExecutionEntity outgoingFlowExecution = executionEntityManager.createChildExecution(execution.getParent()); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/CompleteTaskCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/CompleteTaskCmd.java index 7c8774f8e7c..2c27fe491bf 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/CompleteTaskCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/CompleteTaskCmd.java @@ -92,7 +92,7 @@ public CompleteTaskCmd(String taskId, String userId, Map variabl @Override protected Void execute(CommandContext commandContext, TaskEntity task) { if (StringUtils.isNotEmpty(task.getScopeId()) && ScopeTypes.CMMN.equals(task.getScopeType())) { - throw new FlowableException("The task instance is created by the cmmn engine and should be completed via the cmmn engine API"); + throw new FlowableException("The " + task + " is created by the cmmn engine and should be completed via the cmmn engine API"); } // Backwards compatibility @@ -126,7 +126,7 @@ protected Void execute(CommandContext commandContext, TaskEntity task) { } @Override - protected String getSuspendedTaskException() { - return "Cannot complete a suspended task"; + protected String getSuspendedTaskExceptionPrefix() { + return "Cannot complete"; } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/CompleteTaskWithFormCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/CompleteTaskWithFormCmd.java index a228aa5cd30..817f95df2f5 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/CompleteTaskWithFormCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/CompleteTaskWithFormCmd.java @@ -107,7 +107,7 @@ public CompleteTaskWithFormCmd(String taskId, String formDefinitionId, String ou @Override protected Void execute(CommandContext commandContext, TaskEntity task) { if (StringUtils.isNotEmpty(task.getScopeId()) && ScopeTypes.CMMN.equals(task.getScopeType())) { - throw new FlowableException("The task instance is created by the cmmn engine and should be completed via the cmmn engine API"); + throw new FlowableException("The " + task + " is created by the cmmn engine and should be completed via the cmmn engine API"); } FormService formService = CommandContextUtil.getFormService(); @@ -179,8 +179,8 @@ protected boolean isFormFieldValidationEnabled(TaskEntity task, ProcessEngineCon } @Override - protected String getSuspendedTaskException() { - return "Cannot complete a suspended task"; + protected String getSuspendedTaskExceptionPrefix() { + return "Cannot complete"; } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/CreateAttachmentCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/CreateAttachmentCmd.java index 9ebe7c7b02d..dbac1c28fd7 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/CreateAttachmentCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/CreateAttachmentCmd.java @@ -144,7 +144,7 @@ protected TaskEntity verifyTaskParameters(CommandContext commandContext) { } if (task.isSuspended()) { - throw new FlowableException("It is not allowed to add an attachment to a suspended task"); + throw new FlowableException("It is not allowed to add an attachment to a suspended " + task); } return task; @@ -158,7 +158,7 @@ protected ExecutionEntity verifyExecutionParameters(CommandContext commandContex } if (execution.isSuspended()) { - throw new FlowableException("It is not allowed to add an attachment to a suspended process instance"); + throw new FlowableException("It is not allowed to add an attachment to a suspended " + execution); } return execution; diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DelegateTaskCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DelegateTaskCmd.java index 081eb0aa75f..6de4f213a3d 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DelegateTaskCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DelegateTaskCmd.java @@ -43,8 +43,8 @@ protected Object execute(CommandContext commandContext, TaskEntity task) { } @Override - protected String getSuspendedTaskException() { - return "Cannot delegate a suspended task"; + protected String getSuspendedTaskExceptionPrefix() { + return "Cannot delegate"; } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DeleteHistoricProcessInstanceCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DeleteHistoricProcessInstanceCmd.java index 31cbd3817f9..3f5232a741d 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DeleteHistoricProcessInstanceCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DeleteHistoricProcessInstanceCmd.java @@ -49,7 +49,7 @@ public Object execute(CommandContext commandContext) { throw new FlowableObjectNotFoundException("No historic process instance found with id: " + processInstanceId, HistoricProcessInstance.class); } if (instance.getEndTime() == null) { - throw new FlowableException("Process instance is still running, cannot delete historic process instance: " + processInstanceId); + throw new FlowableException("Process instance is still running, cannot delete " + instance); } if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, instance.getProcessDefinitionId())) { diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DeleteHistoricTaskInstanceCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DeleteHistoricTaskInstanceCmd.java index 18ac51bbc90..719bd762dbe 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DeleteHistoricTaskInstanceCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DeleteHistoricTaskInstanceCmd.java @@ -50,7 +50,7 @@ public Object execute(CommandContext commandContext) { throw new FlowableObjectNotFoundException("No historic task instance found with id: " + taskId, HistoricTaskInstance.class); } if (historicTaskInstance.getEndTime() == null) { - throw new FlowableException("task does not have an endTime, cannot delete historic task instance: " + taskId); + throw new FlowableException("task does not have an endTime, cannot delete " + historicTaskInstance); } CommandContextUtil.getHistoryManager(commandContext).recordHistoricTaskDeleted(historicTaskInstance); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DeleteMultiInstanceExecutionCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DeleteMultiInstanceExecutionCmd.java index af64196b6e3..392a6f39b67 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DeleteMultiInstanceExecutionCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DeleteMultiInstanceExecutionCmd.java @@ -58,15 +58,15 @@ public Void execute(CommandContext commandContext) { MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics = miActivityElement.getLoopCharacteristics(); if (miActivityElement.getLoopCharacteristics() == null) { - throw new FlowableException("No multi instance execution found for execution id " + executionId); + throw new FlowableException("No multi instance execution found for " + execution); } if (!(miActivityElement.getBehavior() instanceof MultiInstanceActivityBehavior)) { - throw new FlowableException("No multi instance behavior found for execution id " + executionId); + throw new FlowableException("No multi instance behavior found for " + execution); } if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, execution.getProcessDefinitionId())) { - throw new FlowableException("Flowable 5 process definitions are not supported"); + throw new FlowableException("Flowable 5 process definitions are not supported for " + execution); } ExecutionEntity miExecution = getMultiInstanceRootExecution(execution); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DispatchEventCommand.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DispatchEventCommand.java index a070e9271ff..e8dc0382690 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DispatchEventCommand.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DispatchEventCommand.java @@ -45,7 +45,7 @@ public Void execute(CommandContext commandContext) { if (eventDispatcher != null && eventDispatcher.isEnabled()) { eventDispatcher.dispatchEvent(event, processEngineConfiguration.getEngineCfgKey()); } else { - throw new FlowableException("Message dispatcher is disabled, cannot dispatch event"); + throw new FlowableException("Message dispatcher is disabled, cannot dispatch " + event); } return null; diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/EvaluateConditionalEventsCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/EvaluateConditionalEventsCmd.java index c0b46acac68..e8e0cd3a184 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/EvaluateConditionalEventsCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/EvaluateConditionalEventsCmd.java @@ -44,7 +44,7 @@ public EvaluateConditionalEventsCmd(String processInstanceId, Map 0) { - throw new FlowableException("Sequential ad-hoc sub process already has an active execution"); + throw new FlowableException("Sequential ad-hoc sub process in " + execution + " already has an active execution"); } } @@ -71,7 +71,7 @@ public Execution execute(CommandContext commandContext) { } if (foundNode == null) { - throw new FlowableException("The requested activity with id " + activityId + " can not be enabled"); + throw new FlowableException("The requested activity with id " + activityId + " can not be enabled in " + execution); } ExecutionEntity activityExecution = CommandContextUtil.getExecutionEntityManager().createChildExecution(execution); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetEnabledActivitiesForAdhocSubProcessCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetEnabledActivitiesForAdhocSubProcessCmd.java index 65f89ae2320..5124ebaac3b 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetEnabledActivitiesForAdhocSubProcessCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetEnabledActivitiesForAdhocSubProcessCmd.java @@ -47,7 +47,7 @@ public List execute(CommandContext commandContext) { } if (!(execution.getCurrentFlowElement() instanceof AdhocSubProcess)) { - throw new FlowableException("The current flow element of the requested execution is not an ad-hoc sub process"); + throw new FlowableException("The current flow element of the requested " + execution + " is not an ad-hoc sub process"); } List enabledFlowNodes = new ArrayList<>(); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetStartFormCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetStartFormCmd.java index c19734ca43a..eeabd824914 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetStartFormCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetStartFormCmd.java @@ -52,7 +52,7 @@ public StartFormData execute(CommandContext commandContext) { FormHandlerHelper formHandlerHelper = CommandContextUtil.getProcessEngineConfiguration(commandContext).getFormHandlerHelper(); StartFormHandler startFormHandler = formHandlerHelper.getStartFormHandler(commandContext, processDefinition); if (startFormHandler == null) { - throw new FlowableException("No startFormHandler defined in process '" + processDefinitionId + "'"); + throw new FlowableException("No startFormHandler defined in process definition '" + processDefinitionId + "'"); } return startFormHandler.createStartFormData(processDefinition); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetTaskFormCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetTaskFormCmd.java index 9023899ff9b..379d29921f0 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetTaskFormCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetTaskFormCmd.java @@ -58,7 +58,7 @@ public TaskFormData execute(CommandContext commandContext) { FormHandlerHelper formHandlerHelper = processEngineConfiguration.getFormHandlerHelper(); TaskFormHandler taskFormHandler = formHandlerHelper.getTaskFormHandlder(task); if (taskFormHandler == null) { - throw new FlowableException("No taskFormHandler specified for task '" + taskId + "'"); + throw new FlowableException("No taskFormHandler specified for '" + task + "'"); } return taskFormHandler.createTaskForm(task); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/InjectEmbeddedSubProcessInProcessInstanceCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/InjectEmbeddedSubProcessInProcessInstanceCmd.java index c8f7e2294c4..c2915a038b3 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/InjectEmbeddedSubProcessInProcessInstanceCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/InjectEmbeddedSubProcessInProcessInstanceCmd.java @@ -83,7 +83,7 @@ protected void updateExecutions(CommandContext commandContext, ProcessDefinition } if (initialEvent == null) { - throw new FlowableException("Could not find a none start event in dynamic sub process"); + throw new FlowableException("Could not find a none start event in dynamic sub process for " + processInstance); } childExecution.setCurrentFlowElement(initialEvent); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/InjectParallelUserTaskCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/InjectParallelUserTaskCmd.java index 89256f3564e..27bb8d969e1 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/InjectParallelUserTaskCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/InjectParallelUserTaskCmd.java @@ -66,7 +66,7 @@ protected void updateBpmnProcess(CommandContext commandContext, Process process, TaskEntity taskEntity = processEngineConfiguration.getTaskServiceConfiguration().getTaskService().getTask(taskId); FlowElement flowElement = process.getFlowElement(taskEntity.getTaskDefinitionKey(), true); if (!(flowElement instanceof UserTask)) { - throw new FlowableException("No UserTask instance found for task definition key " + taskEntity.getTaskDefinitionKey()); + throw new FlowableException("No UserTask instance found for " + taskEntity); } UserTask userTask = (UserTask) flowElement; diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/JobRetryCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/JobRetryCmd.java index 10ed6d22768..9d4c45ebb33 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/JobRetryCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/JobRetryCmd.java @@ -141,7 +141,7 @@ public Object execute(CommandContext commandContext) { newJobEntity.setRetries(jobRetries - 1); } catch (Exception e) { - throw new FlowableException("failedJobRetryTimeCycle has wrong format:" + failedJobRetryTimeCycleValue, exception); + throw new FlowableException("failedJobRetryTimeCycle has wrong format:" + failedJobRetryTimeCycleValue + " for execution " + executionEntity, e); } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/MessageEventReceivedCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/MessageEventReceivedCmd.java index 7d0797f6461..962a9a7bd84 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/MessageEventReceivedCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/MessageEventReceivedCmd.java @@ -79,7 +79,7 @@ protected Void execute(CommandContext commandContext, ExecutionEntity execution) List eventSubscriptions = eventSubscriptionService.findEventSubscriptionsByNameAndExecution(MessageEventHandler.EVENT_HANDLER_TYPE, messageName, executionId); if (eventSubscriptions.isEmpty()) { - throw new FlowableException("Execution with id '" + executionId + "' does not have a subscription to a message event with name '" + messageName + "'"); + throw new FlowableException(execution + " does not have a subscription to a message event with name '" + messageName + "'"); } // there can be only one: @@ -89,4 +89,8 @@ protected Void execute(CommandContext commandContext, ExecutionEntity execution) return null; } + @Override + protected String getSuspendedExceptionMessagePrefix() { + return "Cannot receive message for"; + } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/NeedsActiveExecutionCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/NeedsActiveExecutionCmd.java index 0b10174a20d..42f4a46b970 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/NeedsActiveExecutionCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/NeedsActiveExecutionCmd.java @@ -49,7 +49,7 @@ public T execute(CommandContext commandContext) { } if (execution.isSuspended()) { - throw new FlowableException(getSuspendedExceptionMessage()); + throw new FlowableException(getSuspendedExceptionMessagePrefix() + " a suspended " + execution); } return execute(commandContext, execution); @@ -63,8 +63,8 @@ public T execute(CommandContext commandContext) { /** * Subclasses can override this to provide a more detailed exception message that will be thrown when the execution is suspended. */ - protected String getSuspendedExceptionMessage() { - return "Cannot execution operation because execution '" + executionId + "' is suspended"; + protected String getSuspendedExceptionMessagePrefix() { + return "Cannot execute operation for"; } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/NeedsActiveTaskCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/NeedsActiveTaskCmd.java index 05391852a8a..e32ea0630c5 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/NeedsActiveTaskCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/NeedsActiveTaskCmd.java @@ -54,11 +54,11 @@ public T execute(CommandContext commandContext) { } if (task.isDeleted()) { - throw new FlowableException("Task is already deleted"); + throw new FlowableException(task + " is already deleted"); } if (task.isSuspended()) { - throw new FlowableException(getSuspendedTaskException()); + throw new FlowableException(getSuspendedTaskExceptionPrefix() + " a suspended " + task); } return execute(commandContext, task); @@ -72,8 +72,8 @@ public T execute(CommandContext commandContext) { /** * Subclasses can override this method to provide a customized exception message that will be thrown when the task is suspended. */ - protected String getSuspendedTaskException() { - return "Cannot execute operation: task is suspended"; + protected String getSuspendedTaskExceptionPrefix() { + return "Cannot execute operation for"; } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/RemoveExecutionVariablesCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/RemoveExecutionVariablesCmd.java index 7e9e5c0a514..4e5f30a6adf 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/RemoveExecutionVariablesCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/RemoveExecutionVariablesCmd.java @@ -54,8 +54,8 @@ protected Void execute(CommandContext commandContext, ExecutionEntity execution) } @Override - protected String getSuspendedExceptionMessage() { - return "Cannot remove variables because execution '" + executionId + "' is suspended"; + protected String getSuspendedExceptionMessagePrefix() { + return "Cannot remove variables from"; } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/RemoveTaskVariablesCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/RemoveTaskVariablesCmd.java index 442858ee2a2..c539fdaeff9 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/RemoveTaskVariablesCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/RemoveTaskVariablesCmd.java @@ -55,8 +55,8 @@ protected Void execute(CommandContext commandContext, TaskEntity task) { } @Override - protected String getSuspendedTaskException() { - return "Cannot remove variables from a suspended task."; + protected String getSuspendedTaskExceptionPrefix() { + return "Cannot remove variables from"; } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ResolveTaskCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ResolveTaskCmd.java index ea8cb72f7fc..b034f1bc182 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ResolveTaskCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ResolveTaskCmd.java @@ -57,8 +57,8 @@ protected Void execute(CommandContext commandContext, TaskEntity task) { } @Override - protected String getSuspendedTaskException() { - return "Cannot resolve a suspended task"; + protected String getSuspendedTaskExceptionPrefix() { + return "Cannot resolve"; } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetExecutionVariablesCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetExecutionVariablesCmd.java index fc11b0dc0c0..65138b8667d 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetExecutionVariablesCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetExecutionVariablesCmd.java @@ -76,8 +76,8 @@ protected Object execute(CommandContext commandContext, ExecutionEntity executio } @Override - protected String getSuspendedExceptionMessage() { - return "Cannot set variables because execution '" + executionId + "' is suspended"; + protected String getSuspendedExceptionMessagePrefix() { + return "Cannot set variables to"; } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetTaskVariablesCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetTaskVariablesCmd.java index 2c897f66048..7349be4dd68 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetTaskVariablesCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetTaskVariablesCmd.java @@ -70,8 +70,8 @@ protected Object execute(CommandContext commandContext, TaskEntity task) { } @Override - protected String getSuspendedTaskException() { - return "Cannot add variables to a suspended task"; + protected String getSuspendedTaskExceptionPrefix() { + return "Cannot add variables to"; } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SignalEventReceivedCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SignalEventReceivedCmd.java index 4f3554e522f..e2e0e6b1019 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SignalEventReceivedCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SignalEventReceivedCmd.java @@ -84,7 +84,7 @@ public Void execute(CommandContext commandContext) { } if (execution.isSuspended()) { - throw new FlowableException("Cannot throw signal event '" + eventName + "' because execution '" + executionId + "' is suspended"); + throw new FlowableException("Cannot throw signal event '" + eventName + "' because " + execution + " is suspended"); } if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, execution.getProcessDefinitionId())) { @@ -96,7 +96,7 @@ public Void execute(CommandContext commandContext) { signalEvents = eventSubscriptionService.findSignalEventSubscriptionsByNameAndExecution(eventName, executionId); if (signalEvents.isEmpty()) { - throw new FlowableException("Execution '" + executionId + "' has not subscribed to a signal event with name '" + eventName + "'."); + throw new FlowableException(execution + " has not subscribed to a signal event with name '" + eventName + "'."); } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/StartProgressTaskCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/StartProgressTaskCmd.java index 1f34f75b30d..fe328c9d6a5 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/StartProgressTaskCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/StartProgressTaskCmd.java @@ -53,8 +53,8 @@ protected Void execute(CommandContext commandContext, TaskEntity task) { } @Override - protected String getSuspendedTaskException() { - return "Cannot start progress on a suspended task"; + protected String getSuspendedTaskExceptionPrefix() { + return "Cannot start progress on"; } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SubmitTaskFormCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SubmitTaskFormCmd.java index fde09dd10df..caa3158e21d 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SubmitTaskFormCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SubmitTaskFormCmd.java @@ -77,8 +77,8 @@ protected Void execute(CommandContext commandContext, TaskEntity task) { } @Override - protected String getSuspendedTaskException() { - return "Cannot submit a form to a suspended task"; + protected String getSuspendedTaskExceptionPrefix() { + return "Cannot submit a form to"; } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SuspendTaskCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SuspendTaskCmd.java index 020a3aca6f7..67e4a705c42 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SuspendTaskCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SuspendTaskCmd.java @@ -51,8 +51,8 @@ protected Void execute(CommandContext commandContext, TaskEntity task) { } @Override - protected String getSuspendedTaskException() { - return "Cannot suspend on a suspended task"; + protected String getSuspendedTaskExceptionPrefix() { + return "Cannot suspend"; } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/TriggerCaseTaskCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/TriggerCaseTaskCmd.java index 6f3d7ae7500..bcca0eba245 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/TriggerCaseTaskCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/TriggerCaseTaskCmd.java @@ -58,7 +58,7 @@ public Void execute(CommandContext commandContext) { FlowElement flowElement = execution.getCurrentFlowElement(); if (!(flowElement instanceof CaseServiceTask)) { - throw new FlowableException("No execution could be found with a case service task for id " + executionId); + throw new FlowableException("No execution could be found with a case service task for " + execution); } CaseServiceTask caseServiceTask = (CaseServiceTask) flowElement; @@ -71,11 +71,11 @@ public Void execute(CommandContext commandContext) { if (innerActivityBehavior instanceof CaseTaskActivityBehavior) { ((CaseTaskActivityBehavior) innerActivityBehavior).triggerCaseTask(execution, variables); } else { - throw new FlowableException("Multi instance inner behavior " + innerActivityBehavior + " is not supported"); + throw new FlowableException("Multi instance inner behavior " + innerActivityBehavior + " is not supported for " + execution); } ((MultiInstanceActivityBehavior) behavior).leave(execution); } else { - throw new FlowableException("Behavior " + behavior + " is not supported for a case task"); + throw new FlowableException("Behavior " + behavior + " is not supported for a case task for " + execution); } return null; diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/TriggerCmd.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/TriggerCmd.java index bbc6d04e2a7..5544db877c1 100755 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/TriggerCmd.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/TriggerCmd.java @@ -85,8 +85,8 @@ protected Object execute(CommandContext commandContext, ExecutionEntity executio } @Override - protected String getSuspendedExceptionMessage() { - return "Cannot trigger an execution that is suspended"; + protected String getSuspendedExceptionMessagePrefix() { + return "Cannot trigger"; } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/el/UelExpressionCondition.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/el/UelExpressionCondition.java index 4efc027beb2..58194edb685 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/el/UelExpressionCondition.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/el/UelExpressionCondition.java @@ -37,10 +37,10 @@ public boolean evaluate(String sequenceFlowId, DelegateExecution execution) { Object result = expression.getValue(execution); if (result == null) { - throw new FlowableException("condition expression returns null (sequenceFlowId: " + sequenceFlowId + ")" ); + throw new FlowableException("condition expression returns null (sequenceFlowId: " + sequenceFlowId + ") for " + execution); } if (!(result instanceof Boolean)) { - throw new FlowableException("condition expression returns non-Boolean (sequenceFlowId: " + sequenceFlowId + "): " + result + " (" + result.getClass().getName() + ")"); + throw new FlowableException("condition expression returns non-Boolean (sequenceFlowId: " + sequenceFlowId + "): " + result + " (" + result.getClass().getName() + ") for " + execution); } return (Boolean) result; } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/event/AbstractEventHandler.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/event/AbstractEventHandler.java index 3efcd0e1466..93548799075 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/event/AbstractEventHandler.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/event/AbstractEventHandler.java @@ -33,7 +33,7 @@ public void handleEvent(EventSubscriptionEntity eventSubscription, Object payloa FlowNode currentFlowElement = (FlowNode) execution.getCurrentFlowElement(); if (currentFlowElement == null) { - throw new FlowableException("Error while sending signal for event subscription '" + eventSubscription.getId() + "': " + "no activity associated with event subscription"); + throw new FlowableException("Error while sending signal for " + eventSubscription + ": no activity associated with event subscription"); } EventSubscriptionUtil.processPayloadMap(payload, execution, currentFlowElement, commandContext); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/event/CompensationEventHandler.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/event/CompensationEventHandler.java index dd82e78cc43..3507c18b4d0 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/event/CompensationEventHandler.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/event/CompensationEventHandler.java @@ -50,7 +50,7 @@ public void handleEvent(EventSubscriptionEntity eventSubscription, Object payloa String configuration = eventSubscription.getConfiguration(); if (configuration == null) { - throw new FlowableException("Compensating execution not set for compensate event subscription with id " + eventSubscription.getId()); + throw new FlowableException("Compensating execution not set for " + eventSubscription); } ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext); @@ -59,7 +59,7 @@ public void handleEvent(EventSubscriptionEntity eventSubscription, Object payloa String processDefinitionId = compensatingExecution.getProcessDefinitionId(); Process process = ProcessDefinitionUtil.getProcess(processDefinitionId); if (process == null) { - throw new FlowableException("Cannot start process instance. Process model (id = " + processDefinitionId + ") could not be found"); + throw new FlowableException("Cannot start process instance. Process model (id = " + processDefinitionId + ") could not be found for " + eventSubscription); } FlowElement flowElement = process.getFlowElement(eventSubscription.getActivityId(), true); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/event/SignalEventHandler.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/event/SignalEventHandler.java index 809b504e4ca..0555264646c 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/event/SignalEventHandler.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/event/SignalEventHandler.java @@ -52,13 +52,13 @@ public void handleEvent(EventSubscriptionEntity eventSubscription, Object payloa ProcessDefinition processDefinition = ProcessDefinitionUtil.getProcessDefinition(processDefinitionId); if (processDefinition.isSuspended()) { - throw new FlowableException("Could not handle signal: process definition with id: " + processDefinitionId + " is suspended"); + throw new FlowableException("Could not handle signal: process definition with id: " + processDefinitionId + " is suspended for " + eventSubscription); } // Start process instance via the flow element linked to the event FlowElement flowElement = process.getFlowElement(eventSubscription.getActivityId(), true); if (flowElement == null) { - throw new FlowableException("Could not find matching FlowElement for activityId " + eventSubscription.getActivityId()); + throw new FlowableException("Could not find matching FlowElement for " + eventSubscription); } ProcessInstanceHelper processInstanceHelper = CommandContextUtil.getProcessEngineConfiguration(commandContext).getProcessInstanceHelper(); @@ -69,7 +69,7 @@ public void handleEvent(EventSubscriptionEntity eventSubscription, Object payloa CommandContextUtil.getProcessEngineConfiguration(commandContext).getCaseInstanceService().handleSignalEvent(eventSubscription, getPayloadAsMap(payload)); } else { - throw new FlowableException("Invalid signal handling: no execution nor process definition set"); + throw new FlowableException("Invalid signal handling: no execution nor process definition set for " + eventSubscription); } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/AsyncLeaveJobHandler.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/AsyncLeaveJobHandler.java index fc4354df71b..49c8e63d60a 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/AsyncLeaveJobHandler.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/AsyncLeaveJobHandler.java @@ -138,7 +138,7 @@ protected SequenceFlow determineSequenceFlow(JobEntity job, ExecutionEntity exec } if (sequenceFlow == null) { - throw new FlowableException("Programmatic error: no sequence flow could be found for async leave in job " + job.getId()); + throw new FlowableException("Programmatic error: no sequence flow could be found for async leave in job " + job); } return sequenceFlow; diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/AsyncSendEventJobHandler.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/AsyncSendEventJobHandler.java index e59fca055d1..7c9e5199c1b 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/AsyncSendEventJobHandler.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/AsyncSendEventJobHandler.java @@ -41,13 +41,13 @@ public void execute(JobEntity job, String configuration, VariableScope variableS FlowElement flowElement = executionEntity.getCurrentFlowElement(); if (!(flowElement instanceof SendEventServiceTask)) { - throw new FlowableException(String.format("Unexpected activity type found for job %s, at activity %s", job.getId(), flowElement.getId())); + throw new FlowableException("Unexpected activity type found for " + job + " at " + executionEntity); } Object behavior = ((SendEventServiceTask) flowElement).getBehavior(); if (!(behavior instanceof ActivityBehavior)) { - throw new FlowableException(String.format("Unexpected activity behavior found for job %s, at activity %s: %s", - job.getId(), flowElement.getId(), behavior.getClass())); + throw new FlowableException( + "Unexpected activity behavior (" + behavior.getClass() + ") found for " + job + " at " + executionEntity); } try { diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/TimerActivateProcessDefinitionHandler.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/TimerActivateProcessDefinitionHandler.java index f7b699205fa..94fd33763f7 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/TimerActivateProcessDefinitionHandler.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/TimerActivateProcessDefinitionHandler.java @@ -43,7 +43,7 @@ public void execute(JobEntity job, String configuration, VariableScope variableS JsonNode configNode = processEngineConfiguration.getObjectMapper().readTree(configuration); activateProcessInstances = getIncludeProcessInstances(configNode); } catch (Exception e) { - throw new FlowableException("Error reading json value " + configuration, e); + throw new FlowableException("Error reading json value " + configuration + " for job " + job, e); } String processDefinitionId = job.getProcessDefinitionId(); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/TimerStartEventJobHandler.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/TimerStartEventJobHandler.java index a1ea5fa41e3..1b91117fa7f 100755 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/TimerStartEventJobHandler.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/TimerStartEventJobHandler.java @@ -47,7 +47,7 @@ public void execute(JobEntity job, String configuration, VariableScope variableS ProcessDefinitionEntity processDefinitionEntity = ProcessDefinitionUtil .getProcessDefinitionFromDatabase(job.getProcessDefinitionId()); // From DB -> need to get latest suspended state if (processDefinitionEntity == null) { - throw new FlowableException("Could not find process definition needed for timer start event"); + throw new FlowableException("Could not find process definition needed for timer start event for job " + job); } try { @@ -65,7 +65,7 @@ public void execute(JobEntity job, String configuration, VariableScope variableS if (activityId != null) { FlowElement flowElement = process.getFlowElement(activityId, true); if (flowElement == null) { - throw new FlowableException("Could not find matching FlowElement for activityId " + activityId); + throw new FlowableException("Could not find matching FlowElement for activityId " + activityId + " in " + processDefinitionEntity); } ProcessInstanceHelper processInstanceHelper = processEngineConfiguration.getProcessInstanceHelper(); processInstanceHelper.createAndStartProcessInstanceWithInitialFlowElement(processDefinitionEntity, null, null, null, flowElement, process @@ -75,14 +75,14 @@ public void execute(JobEntity job, String configuration, VariableScope variableS } } else { - LOGGER.debug("ignoring timer of suspended process definition {}", processDefinitionEntity.getName()); + LOGGER.debug("ignoring timer of suspended process definition {}", processDefinitionEntity.getId()); } } catch (RuntimeException e) { - LOGGER.error("exception during timer execution", e); + LOGGER.error("exception during timer execution for {}", job, e); throw e; } catch (Exception e) { - LOGGER.error("exception during timer execution", e); - throw new FlowableException("exception during timer execution: " + e.getMessage(), e); + LOGGER.error("exception during timer execution for {}", job, e); + throw new FlowableException("exception during timer execution for " + job, e); } } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/TimerSuspendProcessDefinitionHandler.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/TimerSuspendProcessDefinitionHandler.java index 85efd5c4c66..e01ab3116e1 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/TimerSuspendProcessDefinitionHandler.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/TimerSuspendProcessDefinitionHandler.java @@ -43,7 +43,7 @@ public void execute(JobEntity job, String configuration, VariableScope variableS JsonNode configNode = processEngineConfiguration.getObjectMapper().readTree(configuration); suspendProcessInstances = getIncludeProcessInstances(configNode); } catch (Exception e) { - throw new FlowableException("Error reading json value " + configuration, e); + throw new FlowableException("Error reading json value " + configuration + " for " + job, e); } String processDefinitionId = job.getProcessDefinitionId(); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ActivityInstanceEntityImpl.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ActivityInstanceEntityImpl.java index 8bb5f7687a6..8ecea4e7b3b 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ActivityInstanceEntityImpl.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ActivityInstanceEntityImpl.java @@ -19,6 +19,7 @@ import java.util.HashMap; import java.util.Map; +import org.apache.commons.lang3.StringUtils; import org.flowable.engine.ProcessEngineConfiguration; import org.flowable.engine.impl.util.CommandContextUtil; @@ -236,7 +237,21 @@ public Date getTime() { @Override public String toString() { - return "ActivityInstanceEntity[id=" + id + ", activityId=" + activityId + ", activityName=" + activityName + ", executionId= " + executionId + "]"; + StringBuilder sb = new StringBuilder(); + sb.append("ActivityInstanceEntity[id=").append(id) + .append(", activityId=").append(activityId); + if (activityName != null) { + sb.append(", activityName=").append(activityName); + } + + sb.append(", executionId=").append(executionId) + .append(", definitionId=").append(processDefinitionId); + + if (StringUtils.isNotEmpty(tenantId)) { + sb.append(", tenantId=").append(tenantId); + } + sb.append("]"); + return sb.toString(); } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ExecutionEntityImpl.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ExecutionEntityImpl.java index 7b83a1b508b..460c885525e 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ExecutionEntityImpl.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ExecutionEntityImpl.java @@ -878,7 +878,7 @@ protected void createVariableLocal(String variableName, Object value, ExecutionE ensureVariableInstancesInitialized(); if (variableInstances.containsKey(variableName)) { - throw new FlowableException("variable '" + variableName + "' already exists. Use setVariableLocal if you want to overwrite the value"); + throw new FlowableException("variable '" + variableName + "' already exists. Use setVariableLocal if you want to overwrite the value for " + this); } createVariableInstance(variableName, value, sourceActivityExecution); @@ -929,7 +929,7 @@ protected VariableInstanceEntity getSpecificVariable(String variableName) { CommandContext commandContext = Context.getCommandContext(); if (commandContext == null) { - throw new FlowableException("lazy loading outside command context"); + throw new FlowableException("lazy loading outside command context for " + this); } ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext); @@ -945,7 +945,7 @@ protected VariableInstanceEntity getSpecificVariable(String variableName) { protected List getSpecificVariables(Collection variableNames) { CommandContext commandContext = Context.getCommandContext(); if (commandContext == null) { - throw new FlowableException("lazy loading outside command context"); + throw new FlowableException("lazy loading outside command context for " + this); } ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext); @@ -1484,7 +1484,7 @@ protected void resolveProcessDefinitionInfo() { } ProcessDefinition processDefinition = ProcessDefinitionUtil.getProcessDefinition(processDefinitionId, false, processEngineConfiguration); if (processDefinition == null) { - throw new FlowableException("Cannot get process definition for id " + processDefinitionId); + throw new FlowableException("Cannot get process definition for id " + processDefinitionId + " for " + this); } this.processDefinitionKey = processDefinition.getKey(); @@ -1498,10 +1498,11 @@ protected void resolveProcessDefinitionInfo() { @Override public String toString() { + StringBuilder strb; if (isProcessInstanceType()) { - return "ProcessInstance[" + getId() + "]"; + strb = new StringBuilder("ProcessInstance[" + getId() + "] - definition '" + getProcessDefinitionId() + "'"); } else { - StringBuilder strb = new StringBuilder(); + strb = new StringBuilder(); if (isScope) { strb.append("Scoped execution[ id '").append(getId()); } else if (isMultiInstanceRoot) { @@ -1510,6 +1511,7 @@ public String toString() { strb.append("Execution[ id '").append(getId()); } strb.append("' ]"); + strb.append(" - definition '").append(getProcessDefinitionId()).append("'"); if (activityId != null) { strb.append(" - activity '").append(activityId).append("'"); @@ -1517,8 +1519,12 @@ public String toString() { if (parentId != null) { strb.append(" - parent '").append(parentId).append("'"); } - return strb.toString(); } + + if (StringUtils.isNotEmpty(tenantId)) { + strb.append(" - tenantId '").append(tenantId).append("'"); + } + return strb.toString(); } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ExecutionEntityManagerImpl.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ExecutionEntityManagerImpl.java index b8119a82533..8267938c948 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ExecutionEntityManagerImpl.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ExecutionEntityManagerImpl.java @@ -469,7 +469,7 @@ public void deleteProcessInstance(String processInstanceId, String deleteReason, subProcessActivityBehavior.completed(superExecution); } catch (Exception e) { throw new FlowableException("Could not complete parent process instance for call activity with process instance execution " - + processInstanceExecution.getId(), e); + + processInstanceExecution, e); } } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/HistoricDetailEntityManagerImpl.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/HistoricDetailEntityManagerImpl.java index cddab545575..bf88a425a20 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/HistoricDetailEntityManagerImpl.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/HistoricDetailEntityManagerImpl.java @@ -56,7 +56,7 @@ public HistoricFormPropertyEntity insertHistoricFormPropertyEntity(ExecutionEnti if (activityInstance != null) { activityInstanceId = activityInstance.getId(); } else { - throw new FlowableException("ActivityInstance not found for execution "+execution.getId()); + throw new FlowableException("ActivityInstance not found for " + execution); } historicFormPropertyEntity.setActivityInstanceId(activityInstanceId); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/HistoricProcessInstanceEntityImpl.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/HistoricProcessInstanceEntityImpl.java index 6d02805f5e5..47847005dbe 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/HistoricProcessInstanceEntityImpl.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/HistoricProcessInstanceEntityImpl.java @@ -18,6 +18,7 @@ import java.util.List; import java.util.Map; +import org.apache.commons.lang3.StringUtils; import org.flowable.common.engine.impl.context.Context; import org.flowable.engine.ProcessEngineConfiguration; import org.flowable.variable.service.impl.persistence.entity.HistoricVariableInitializingList; @@ -361,6 +362,22 @@ public void setQueryVariables(List queryVariable @Override public String toString() { - return "HistoricProcessInstanceEntity[superProcessInstanceId=" + superProcessInstanceId + "]"; + StringBuilder sb = new StringBuilder(); + sb.append("HistoricProcessInstanceEntity[id=").append(getId()) + .append(", definition=").append(getProcessDefinitionId()); + if (superProcessInstanceId != null) { + sb.append(", superProcessInstanceId=").append(superProcessInstanceId); + } + + if (referenceId != null) { + sb.append(", referenceId=").append(referenceId) + .append(", referenceType=").append(referenceType); + } + + if (StringUtils.isNotEmpty(tenantId)) { + sb.append(", tenantId=").append(tenantId); + } + sb.append("]"); + return sb.toString(); } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/data/impl/MybatisProcessDefinitionDataManager.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/data/impl/MybatisProcessDefinitionDataManager.java index 309f4f8c45b..ea2b48e4b37 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/data/impl/MybatisProcessDefinitionDataManager.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/data/impl/MybatisProcessDefinitionDataManager.java @@ -147,7 +147,7 @@ public ProcessDefinitionEntity findProcessDefinitionByKeyAndVersionAndTenantId(S if (results.size() == 1) { return results.get(0); } else if (results.size() > 1) { - throw new FlowableException("There are " + results.size() + " process definitions with key = '" + processDefinitionKey + "' and version = '" + processDefinitionVersion + "'."); + throw new FlowableException("There are " + results.size() + " process definitions with key = '" + processDefinitionKey + "' and version = '" + processDefinitionVersion + "' in tenant='" + tenantId + "'."); } return null; } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/scripting/ScriptCondition.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/scripting/ScriptCondition.java index 4a016ce42c7..4fe97bee020 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/scripting/ScriptCondition.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/scripting/ScriptCondition.java @@ -42,10 +42,10 @@ public boolean evaluate(String sequenceFlowId, DelegateExecution execution) { .variableContainer(execution); Object result = scriptingEngines.evaluate(builder.build()).getResult(); if (result == null) { - throw new FlowableException("condition script returns null: " + expression); + throw new FlowableException("condition script returns null: " + expression + " for " + execution); } if (!(result instanceof Boolean)) { - throw new FlowableException("condition script returns non-Boolean: " + result + " (" + result.getClass().getName() + ")"); + throw new FlowableException("condition script returns non-Boolean: " + result + " (" + result.getClass().getName() + ") for " + execution); } return (Boolean) result; } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/util/EventSubscriptionUtil.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/util/EventSubscriptionUtil.java index 308a34ac7dc..bc6da8795ed 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/util/EventSubscriptionUtil.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/util/EventSubscriptionUtil.java @@ -77,7 +77,7 @@ protected static void processEventSync(EventSubscriptionEntity eventSubscription EventHandler eventHandler = processEngineConfiguration.getEventHandler(eventSubscriptionEntity.getEventType()); if (eventHandler == null) { - throw new FlowableException("Could not find eventhandler for event of type '" + eventSubscriptionEntity.getEventType() + "'."); + throw new FlowableException("Could not find eventhandler for event of type '" + eventSubscriptionEntity.getEventType() + "' for " + eventSubscriptionEntity); } eventHandler.handleEvent(eventSubscriptionEntity, payload, CommandContextUtil.getCommandContext()); } @@ -99,7 +99,7 @@ protected static void scheduleEventAsync(EventSubscriptionEntity eventSubscripti FlowNode currentFlowElement = (FlowNode) execution.getCurrentFlowElement(); if (currentFlowElement == null) { - throw new FlowableException("Error while sending signal for event subscription '" + eventSubscriptionEntity.getId() + "': " + "no activity associated with event subscription"); + throw new FlowableException("Error while sending signal for " + eventSubscriptionEntity + " no activity associated with event subscription"); } EventSubscriptionUtil.processPayloadMap(payload, execution, currentFlowElement, commandContext); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/util/TaskHelper.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/util/TaskHelper.java index d125e5a0647..6d444f774b9 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/util/TaskHelper.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/util/TaskHelper.java @@ -68,7 +68,7 @@ public static void completeTask(TaskEntity taskEntity, String userId, Map transientVariables, Map localTransientVariables, CommandContext commandContext) { if (taskEntity.getDelegationState() != null && taskEntity.getDelegationState() == DelegationState.PENDING) { - throw new FlowableException("A delegated task cannot be completed, but should be resolved instead."); + throw new FlowableException("A delegated " + taskEntity + " cannot be completed, but should be resolved instead."); } if (localVariables != null && !localVariables.isEmpty()) { @@ -492,9 +492,9 @@ public static void deleteTask(String taskId, String deleteReason, boolean cascad if (task != null) { if (task.getExecutionId() != null) { - throw new FlowableException("The task cannot be deleted because is part of a running process"); + throw new FlowableException("The " + task + " cannot be deleted because is part of a running process"); } else if (task.getScopeId() != null && ScopeTypes.CMMN.equals(task.getScopeType())) { - throw new FlowableException("The task cannot be deleted because is part of a running case"); + throw new FlowableException("The " + task + " cannot be deleted because is part of a running case"); } if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, task.getProcessDefinitionId())) { @@ -610,7 +610,7 @@ public static boolean isFormFieldValidationEnabled(VariableContainer variableCon expressionManager.createExpression(formFieldValidationExpression).getValue(variableContainer) ); if (formFieldValidationValue == null) { - throw new FlowableException("Unable to resolve formFieldValidationExpression to boolean value"); + throw new FlowableException("Unable to resolve formFieldValidationExpression to boolean value for " + variableContainer); } return formFieldValidationValue; } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/util/TimerUtil.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/util/TimerUtil.java index 243ec7a68a6..1654fef8a0b 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/util/TimerUtil.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/util/TimerUtil.java @@ -126,7 +126,7 @@ public static TimerJobEntity createTimerEntityForTimerEventDefinition(TimerEvent } else if (dueDateValue != null) { throw new FlowableException("Timer '" + executionEntity.getActivityId() - + "' was not configured with a valid duration/time, either hand in a java.util.Date or a java.time.Instant or a org.joda.time.DateTime or a String in format 'yyyy-MM-dd'T'hh:mm:ss'"); + + "' in " + executionEntity + " was not configured with a valid duration/time, either hand in a java.util.Date or a java.time.Instant or a org.joda.time.DateTime or a String in format 'yyyy-MM-dd'T'hh:mm:ss'"); } if (duedate == null && dueDateString != null) { @@ -176,7 +176,11 @@ public static TimerJobEntity createTimerEntityForTimerEventDefinition(TimerEvent } } else { - throw new FlowableException("Due date could not be determined for timer job " + dueDateString); + StringBuilder sb = new StringBuilder("Due date could not be determined for timer job ").append(dueDateString); + if (executionEntity != null) { + sb.append(" for ").append(executionEntity); + } + throw new FlowableException(sb.toString()); } if (StringUtils.isNotEmpty(timerEventDefinition.getTimeCycle())) { diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/mgmt/ExternalWorkerJobQueryTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/mgmt/ExternalWorkerJobQueryTest.java index c1b14ec2809..d2b4f27ddbe 100755 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/mgmt/ExternalWorkerJobQueryTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/mgmt/ExternalWorkerJobQueryTest.java @@ -492,8 +492,12 @@ public void testUnaquireWithJobId() { managementService.unacquireExternalWorkerJob(worker2Job.getId(), "testWorker1"); }).isInstanceOf(FlowableException.class) - .hasMessageContaining("Job is locked with a different worker id"); - + .hasMessage("ExternalWorkerJobEntity[id=" + worker2Job.getId() + + ", jobHandlerType=external-worker-complete, jobType=externalWorker, elementId=externalCustomer1, correlationId=" + + worker2Job.getCorrelationId() + ", processInstanceId=" + worker2Job.getProcessInstanceId() + + ", executionId=" + worker2Job.getExecutionId() + ", processDefinitionId=" + worker2Job.getProcessDefinitionId() + + "] is locked with a different worker id"); + managementService.unacquireExternalWorkerJob(worker2Job.getId(), "testWorker2"); assertThat(query.count()).isEqualTo(0); diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/mgmt/ManagementServiceTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/mgmt/ManagementServiceTest.java index ef8b03d5400..902b3faf228 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/mgmt/ManagementServiceTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/mgmt/ManagementServiceTest.java @@ -397,7 +397,8 @@ public void testDeleteJobThatWasAlreadyAcquired() { // Try to delete the job. This should fail. assertThatThrownBy(() -> managementService.deleteJob(timerJob.getId())) .isExactlyInstanceOf(FlowableException.class) - .hasMessageContaining("Cannot delete job when the job is being executed. Try again later."); + .hasMessageContainingAll("Cannot delete JobEntity[", "jobHandlerType=trigger-timer, jobType=timer, elementId=escalationTimer", + "processDefinitionId=timerOnTask:1:", " when the job is being executed. Try again later."); // Clean up managementService.executeJob(timerJob.getId()); @@ -424,7 +425,8 @@ public void testDeleteTimerJobThatWasAlreadyAcquired() { // Try to delete the job. This should fail. assertThatThrownBy(() -> managementService.deleteTimerJob(timerJob.getId())) .isExactlyInstanceOf(FlowableException.class) - .hasMessageContaining("Cannot delete timer job when the job is being executed. Try again later."); + .hasMessageContainingAll("Cannot delete TimerJobEntity[", "jobHandlerType=trigger-timer, jobType=timer, elementId=escalationTimer", + "processDefinitionId=timerOnTask:1:", " when the job is being executed. Try again later."); // Clean up managementService.moveTimerToExecutableJob(timerJob.getId()); diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/ProcessInstanceCommentTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/ProcessInstanceCommentTest.java index 5e339807460..d2d6ba6f1ca 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/ProcessInstanceCommentTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/ProcessInstanceCommentTest.java @@ -52,7 +52,7 @@ public void testAddCommentToProcessInstance() { runtimeService.suspendProcessInstanceById(processInstance.getId()); assertThatThrownBy(() -> taskService.addComment(null, processInstance.getId(), "Hello World 2")) .isInstanceOf(FlowableException.class) - .hasMessageContaining("Cannot add a comment to a suspended execution"); + .hasMessage("Cannot add a comment to a suspended ProcessInstance[" + processInstance.getId() + "] - definition '" + processInstance.getProcessDefinitionId() + "'"); // Delete comments again taskService.deleteComments(null, processInstance.getId()); diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/ProcessInstanceSuspensionTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/ProcessInstanceSuspensionTest.java index bfdf50c3ffd..f58ed2ddc4e 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/ProcessInstanceSuspensionTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/ProcessInstanceSuspensionTest.java @@ -219,63 +219,64 @@ public void testProcessInstanceOperationsFailAfterSuspend() { // Suspend process instance ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult(); ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.getId()); + String processInstanceError = "ProcessInstance[" + processInstance.getId() + "] - definition '" + processInstance.getProcessDefinitionId() + "'"; runtimeService.suspendProcessInstanceById(processInstance.getId()); assertThatThrownBy(() -> runtimeService.messageEventReceived("someMessage", processInstance.getId())) .isExactlyInstanceOf(FlowableException.class) - .hasMessageContaining("is suspended"); + .hasMessage("Cannot receive message for a suspended " + processInstanceError); assertThatThrownBy(() -> runtimeService.messageEventReceived("someMessage", processInstance.getId(), new HashMap<>())) .isExactlyInstanceOf(FlowableException.class) - .hasMessageContaining("is suspended"); + .hasMessage("Cannot receive message for a suspended " + processInstanceError); assertThatThrownBy(() -> runtimeService.removeVariable(processInstance.getId(), "someVariable")) .isExactlyInstanceOf(FlowableException.class) - .hasMessageContaining("is suspended"); + .hasMessage("Cannot remove variables from a suspended " + processInstanceError); assertThatThrownBy(() -> runtimeService.removeVariableLocal(processInstance.getId(), "someVariable")) .isExactlyInstanceOf(FlowableException.class) - .hasMessageContaining("is suspended"); + .hasMessage("Cannot remove variables from a suspended " + processInstanceError); assertThatThrownBy(() -> runtimeService.removeVariables(processInstance.getId(), Arrays.asList("one", "two", "three"))) .isExactlyInstanceOf(FlowableException.class) - .hasMessageContaining("is suspended"); + .hasMessage("Cannot remove variables from a suspended " + processInstanceError); assertThatThrownBy(() -> runtimeService.removeVariablesLocal(processInstance.getId(), Arrays.asList("one", "two", "three"))) .isExactlyInstanceOf(FlowableException.class) - .hasMessageContaining("is suspended"); + .hasMessage("Cannot remove variables from a suspended " + processInstanceError); assertThatThrownBy(() -> runtimeService.setVariable(processInstance.getId(), "someVariable", "someValue")) .isExactlyInstanceOf(FlowableException.class) - .hasMessageContaining("is suspended"); + .hasMessage("Cannot set variables to a suspended " + processInstanceError); assertThatThrownBy(() -> runtimeService.setVariableLocal(processInstance.getId(), "someVariable", "someValue")) .isExactlyInstanceOf(FlowableException.class) - .hasMessageContaining("is suspended"); + .hasMessage("Cannot set variables to a suspended " + processInstanceError); assertThatThrownBy(() -> runtimeService.setVariables(processInstance.getId(), new HashMap<>())) .isExactlyInstanceOf(FlowableException.class) - .hasMessageContaining("is suspended"); + .hasMessage("Cannot set variables to a suspended " + processInstanceError); assertThatThrownBy(() -> runtimeService.setVariablesLocal(processInstance.getId(), new HashMap<>())) .isExactlyInstanceOf(FlowableException.class) - .hasMessageContaining("is suspended"); + .hasMessage("Cannot set variables to a suspended " + processInstanceError); assertThatThrownBy(() -> runtimeService.trigger(processInstance.getId())) .isExactlyInstanceOf(FlowableException.class) - .hasMessageContaining("is suspended"); + .hasMessage("Cannot trigger a suspended " + processInstanceError); assertThatThrownBy(() -> runtimeService.trigger(processInstance.getId(), new HashMap<>())) .isExactlyInstanceOf(FlowableException.class) - .hasMessageContaining("is suspended"); + .hasMessage("Cannot trigger a suspended " + processInstanceError); assertThatThrownBy(() -> runtimeService.signalEventReceived("someSignal", processInstance.getId())) .isExactlyInstanceOf(FlowableException.class) - .hasMessageContaining("is suspended"); + .hasMessage("Cannot throw signal event 'someSignal' because " + processInstanceError + " is suspended"); assertThatThrownBy(() -> runtimeService.signalEventReceived("someSignal", processInstance.getId(), new HashMap<>())) .isExactlyInstanceOf(FlowableException.class) - .hasMessageContaining("is suspended"); + .hasMessage("Cannot throw signal event 'someSignal' because " + processInstanceError + " is suspended"); } @Test diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/migration/ProcessInstanceMigrationGatewaysTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/migration/ProcessInstanceMigrationGatewaysTest.java index 5fc3668c7b7..6c9a31bd907 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/migration/ProcessInstanceMigrationGatewaysTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/migration/ProcessInstanceMigrationGatewaysTest.java @@ -1412,7 +1412,8 @@ public void testMigrateActivityToInclusiveGatewaySplitNoOutgoingSequenceSelectio processInstanceMigrationBuilder.migrate(processInstance.getId()); }) .isExactlyInstanceOf(FlowableException.class) - .hasMessage("No outgoing sequence flow of element 'gwFork' could be selected for continuing the process"); + .hasMessageStartingWith("No outgoing sequence flow of element 'gwFork' could be selected for continuing the process for Execution[ id '") + .hasMessageContainingAll(" - definition 'startInclusiveGwProcess:1:", " - activity 'gwFork'"); } @Test diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/task/TaskIdentityLinksTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/task/TaskIdentityLinksTest.java index 34520b6edbd..af2cee997c6 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/task/TaskIdentityLinksTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/task/TaskIdentityLinksTest.java @@ -473,7 +473,8 @@ public void testAddUserIdentityLinkAndCompleteTaskInSameTransaction() { @Deployment(resources = "org/flowable/engine/test/api/task/IdentityLinksProcess.bpmn20.xml") public void testCompleteTaskAndAddGroupIdentityLinkAfterInSameTransaction() { runtimeService.startProcessInstanceByKey("IdentityLinksProcess"); - String taskId = taskService.createTaskQuery().singleResult().getId(); + Task task = taskService.createTaskQuery().singleResult(); + String taskId = task.getId(); assertThatThrownBy(() -> managementService.executeCommand(context -> { taskService.complete(taskId); @@ -481,14 +482,16 @@ public void testCompleteTaskAndAddGroupIdentityLinkAfterInSameTransaction() { return null; })) .isInstanceOf(FlowableException.class) - .hasMessageContaining("Task is already deleted"); + .hasMessage("Task[id=" + task.getId() + ", key=theTask, name=my task, processInstanceId=" + task.getProcessInstanceId() + ", executionId=" + + task.getExecutionId() + ", processDefinitionId=" + task.getProcessDefinitionId() + "] is already deleted"); } @Test @Deployment(resources = "org/flowable/engine/test/api/task/IdentityLinksProcess.bpmn20.xml") public void testCompleteTaskAndAddUserIdentityLinkAfterInSameTransaction() { runtimeService.startProcessInstanceByKey("IdentityLinksProcess"); - String taskId = taskService.createTaskQuery().singleResult().getId(); + Task task = taskService.createTaskQuery().singleResult(); + String taskId = task.getId(); assertThatThrownBy(() -> managementService.executeCommand(context -> { taskService.complete(taskId); @@ -496,7 +499,8 @@ public void testCompleteTaskAndAddUserIdentityLinkAfterInSameTransaction() { return null; })) .isInstanceOf(FlowableException.class) - .hasMessageContaining("Task is already deleted"); + .hasMessage("Task[id=" + task.getId() + ", key=theTask, name=my task, processInstanceId=" + task.getProcessInstanceId() + ", executionId=" + + task.getExecutionId() + ", processDefinitionId=" + task.getProcessDefinitionId() + "] is already deleted"); } private void assertTaskEvent(String taskId, int expectedCount, String expectedAction, diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/task/TaskServiceTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/task/TaskServiceTest.java index dd47a87fb60..318b18f1226 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/task/TaskServiceTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/task/TaskServiceTest.java @@ -967,7 +967,8 @@ public void testCompleteWithExecutionBaseNewPropertyExpressionTask() { taskParams.put("${execution.myParam}", "myValue"); assertThatThrownBy(() -> taskService.complete(task.getId(), taskParams)) .isExactlyInstanceOf(FlowableException.class) - .hasMessage("Error while evaluating expression: ${execution.myParam}"); + .hasMessageStartingWith("Error while evaluating expression: ${execution.myParam} with Execution[") + .hasMessageContainingAll(" - definition 'twoTasksProcess:1:", " - activity 'firstTask'"); } @Test @@ -2056,31 +2057,33 @@ public void testDeleteTaskPartOfProcess() { runtimeService.startProcessInstanceByKey("oneTaskProcess"); org.flowable.task.api.Task task = taskService.createTaskQuery().singleResult(); assertThat(task).isNotNull(); + String taskErrorString = "Task[id=" + task.getId() + ", key=theTask, name=my task, processInstanceId=" + task.getProcessInstanceId() + ", executionId=" + + task.getExecutionId() + ", processDefinitionId=" + task.getProcessDefinitionId() + "]"; assertThatThrownBy(() -> taskService.deleteTask(task.getId())) .isInstanceOf(FlowableException.class) - .hasMessage("The task cannot be deleted because is part of a running process"); + .hasMessage("The " + taskErrorString + " cannot be deleted because is part of a running process"); assertThatThrownBy(() -> taskService.deleteTask(task.getId(), true)) .isInstanceOf(FlowableException.class) - .hasMessage("The task cannot be deleted because is part of a running process"); + .hasMessage("The " + taskErrorString + " cannot be deleted because is part of a running process"); assertThatThrownBy(() -> taskService.deleteTask(task.getId(), "test")) .isInstanceOf(FlowableException.class) - .hasMessage("The task cannot be deleted because is part of a running process"); + .hasMessage("The " + taskErrorString + " cannot be deleted because is part of a running process"); String idLists[] = { task.getId() }; assertThatThrownBy(() -> taskService.deleteTasks(Arrays.asList(idLists))) .isInstanceOf(FlowableException.class) - .hasMessage("The task cannot be deleted because is part of a running process"); + .hasMessage("The " + taskErrorString + " cannot be deleted because is part of a running process"); assertThatThrownBy(() -> taskService.deleteTasks(Arrays.asList(idLists), true)) .isInstanceOf(FlowableException.class) - .hasMessage("The task cannot be deleted because is part of a running process"); + .hasMessage("The " + taskErrorString + " cannot be deleted because is part of a running process"); assertThatThrownBy(() -> taskService.deleteTasks(Arrays.asList(idLists), "test")) .isInstanceOf(FlowableException.class) - .hasMessage("The task cannot be deleted because is part of a running process"); + .hasMessage("The " + taskErrorString + " cannot be deleted because is part of a running process"); } @Test diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/callactivity/CallActivityWithElementType.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/callactivity/CallActivityWithElementType.java index a5dc6c71f95..88443f8fb55 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/callactivity/CallActivityWithElementType.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/callactivity/CallActivityWithElementType.java @@ -88,7 +88,8 @@ public void testCallSimpleSubProcessWithUnrecognizedElementType() throws IOExcep Collections.singletonMap("subProcessDefinitionKey", "simpleSubProcess"))) .as("Flowable exception expected") .isInstanceOf(FlowableException.class) - .hasMessage("Unrecognized calledElementType [unrecognizedElementType]"); + .hasMessageStartingWith("Unrecognized calledElementType [unrecognizedElementType] in Execution[") + .hasMessageContainingAll(" - definition 'callSimpleSubProcess:1:", " - activity 'callSubProcess'"); } protected void assertThatSubProcessIsCalled(String deploymentId, Map variables) { diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/event/escalation/BoundaryEscalationEventTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/event/escalation/BoundaryEscalationEventTest.java index af98536ba64..0f42e570265 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/event/escalation/BoundaryEscalationEventTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/event/escalation/BoundaryEscalationEventTest.java @@ -19,6 +19,8 @@ import org.assertj.core.api.ThrowableAssert.ThrowingCallable; import org.flowable.common.engine.api.FlowableException; import org.flowable.engine.impl.test.PluggableFlowableTestCase; +import org.flowable.engine.runtime.Execution; +import org.flowable.engine.runtime.ProcessInstance; import org.flowable.engine.test.Deployment; import org.flowable.task.api.Task; import org.junit.jupiter.api.Test; @@ -67,18 +69,21 @@ public void testCatchEscalationOnCallActivity() { "org/flowable/engine/test/bpmn/event/escalation/BoundaryEscalationEventTest.testCatchEscalationOnCallActivitySuspendedParent.parent.bpmn20.xml", "org/flowable/engine/test/bpmn/event/escalation/BoundaryEscalationEventTest.testCatchEscalationOnCallActivitySuspendedParent.child.bpmn20.xml" }) public void testCatchEscalationOnCallActivitySuspendedParent() { - String parentProcId = runtimeService.startProcessInstanceByKey("escalationParent").getId(); + ProcessInstance escalationParent = runtimeService.startProcessInstanceByKey("escalationParent"); + String parentProcId = escalationParent.getId(); String childProcId = runtimeService.createProcessInstanceQuery().processDefinitionKey("escalationChild").singleResult().getId(); - String boundaryEventExecutionId = runtimeService.createExecutionQuery().activityId("boundaryEventId").singleResult().getId(); + Execution boundaryEventExecution = runtimeService.createExecutionQuery().activityId("boundaryEventId").singleResult(); + String boundaryEventExecutionId = boundaryEventExecution.getId(); runtimeService.suspendProcessInstanceById(parentProcId); // Propagates escalation from the child process instance ThrowingCallable propagateEscalation = () -> managementService .executeJob(managementService.createJobQuery().processInstanceId(childProcId).singleResult().getId()); - String expectedErrorMessage = format("Cannot propagate escalation 'testChildEscalation' with code 'testEscalationCode', because execution '%s' is suspended.", boundaryEventExecutionId); assertThatThrownBy(propagateEscalation) - .isInstanceOf(FlowableException.class) - .hasMessage(expectedErrorMessage); + .isInstanceOf(FlowableException.class) + .hasMessage( + "Cannot propagate escalation 'testChildEscalation' with code 'testEscalationCode', because Execution[ id '%s' ] - definition '%s' - activity 'boundaryEventId' - parent '%s' is suspended".formatted( + boundaryEventExecutionId, escalationParent.getProcessDefinitionId(), boundaryEventExecution.getParentId())); } } diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/event/timer/BoundaryTimerEventTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/event/timer/BoundaryTimerEventTest.java index 21b56db3a02..6335e5fd317 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/event/timer/BoundaryTimerEventTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/event/timer/BoundaryTimerEventTest.java @@ -244,7 +244,8 @@ public void testNullExpressionOnTimer() { assertThatThrownBy(() -> runtimeService.startProcessInstanceByKey("testNullExpressionOnTimer", variables)) .as("Expected wrong due date exception") .isInstanceOf(FlowableException.class) - .hasMessage("Due date could not be determined for timer job null"); + .hasMessageStartingWith("Due date could not be determined for timer job null for Execution[") + .hasMessageContainingAll(" - definition 'testNullExpressionOnTimer:1:", " - activity 'boundaryTimer'"); } @Test @@ -278,7 +279,8 @@ public void testNullDueDateWithWrongRepetition() { assertThatThrownBy(() -> runtimeService.startProcessInstanceByKey("test-timers", variables).getProcessInstanceId()) .as("Expected wrong due date exception") .isInstanceOf(FlowableException.class) - .hasMessage("Due date could not be determined for timer job 0 0 0 1 1 ? 2000"); + .hasMessageStartingWith("Due date could not be determined for timer job 0 0 0 1 1 ? 2000 for Execution[") + .hasMessageContainingAll(" - definition 'test-timers:1:", " - activity 'remind-reviewer-event'"); } @Test diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/gateway/ExclusiveGatewayTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/gateway/ExclusiveGatewayTest.java index 43cfc296cc8..b51bd4f923a 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/gateway/ExclusiveGatewayTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/gateway/ExclusiveGatewayTest.java @@ -79,7 +79,8 @@ public void testMultipleValidConditions() { public void testNoSequenceFlowSelected() { assertThatThrownBy(() -> runtimeService.startProcessInstanceByKey("exclusiveGwNoSeqFlowSelected", CollectionUtil.singletonMap("input", 4))) .isInstanceOf(FlowableException.class) - .hasMessage("No outgoing sequence flow of the exclusive gateway " + "'exclusiveGw' could be selected for continuing the process"); + .hasMessageStartingWith("No outgoing sequence flow of the exclusive gateway " + "'exclusiveGw' could be selected for continuing Execution[ id") + .hasMessageContainingAll(" - definition 'exclusiveGwNoSeqFlowSelected:1:", " - activity 'exclusiveGw'"); } /** diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/mail/EmailSendTaskTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/mail/EmailSendTaskTest.java index 8206cc6430e..9b84c01db7f 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/mail/EmailSendTaskTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/mail/EmailSendTaskTest.java @@ -340,7 +340,8 @@ public void testInvalidAddress() throws Exception { public void testMissingAnyRecipientAddress() { assertThatThrownBy(() -> runtimeService.startProcessInstanceByKey("missingAnyRecipientAddress")) .isInstanceOf(FlowableException.class) - .hasMessage("No recipient could be found for sending email"); + .hasMessageStartingWith("No recipient could be found for sending email for Execution[") + .hasMessageContainingAll(" - definition 'missingAnyRecipientAddress:1:", " - activity 'sendMail'"); } @Test @@ -349,7 +350,8 @@ public void testMissingAnyRecipientAddressWithForceTo() { processEngineConfiguration.setMailServerForceTo("no-reply@flowable.org"); assertThatThrownBy(() -> runtimeService.startProcessInstanceByKey("missingAnyRecipientAddress")) .isInstanceOf(FlowableException.class) - .hasMessage("No recipient could be found for sending email"); + .hasMessageStartingWith("No recipient could be found for sending email for Execution[") + .hasMessageContainingAll(" - definition 'missingAnyRecipientAddress:1:", " - activity 'sendMail'"); } @Test diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/mail/EmailServiceTaskTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/mail/EmailServiceTaskTest.java index 4d67108aca8..26e1477d757 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/mail/EmailServiceTaskTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/mail/EmailServiceTaskTest.java @@ -562,7 +562,8 @@ public void testInvalidAddressWithoutExceptionVariableName() throws Exception { public void testMissingAnyRecipientAddress() { assertThatThrownBy(() -> runtimeService.startProcessInstanceByKey("missingAnyRecipientAddress")) .isInstanceOf(FlowableException.class) - .hasMessage("No recipient could be found for sending email"); + .hasMessageStartingWith("No recipient could be found for sending email for Execution[") + .hasMessageContainingAll(" - definition 'missingAnyRecipientAddress:1:", " - activity 'sendMail'"); } @Test @@ -571,7 +572,8 @@ public void testMissingAnyRecipientAddressWithForceTo() { processEngineConfiguration.setMailServerForceTo("no-reply@flowable.org"); assertThatThrownBy(() -> runtimeService.startProcessInstanceByKey("missingAnyRecipientAddress")) .isInstanceOf(FlowableException.class) - .hasMessage("No recipient could be found for sending email"); + .hasMessageStartingWith("No recipient could be found for sending email for Execution[") + .hasMessageContainingAll(" - definition 'missingAnyRecipientAddress:1:", " - activity 'sendMail'"); } // Helper diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/multiinstance/MultiInstanceVariableAggregationTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/multiinstance/MultiInstanceVariableAggregationTest.java index 194d2f42297..e239155ca38 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/multiinstance/MultiInstanceVariableAggregationTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/multiinstance/MultiInstanceVariableAggregationTest.java @@ -917,7 +917,8 @@ public void testParallelMultiInstanceUserTaskWithExpressionModifyingOverviewVari .setValue("testUser", execution); return null; }); - }).hasMessage("Error while evaluating expression: ${reviews[0].userId}"); + }).hasMessageStartingWith("Error while evaluating expression: ${reviews[0].userId} with ProcessInstance[") + .hasMessageContaining(" - definition 'myProcess:1:"); reviewsInstance = runtimeService.getVariableInstance(processInstance.getId(), "reviews"); diff --git a/modules/flowable-engine/src/test/java/org/flowable/examples/bpmn/scripttask/ScriptTaskTest.java b/modules/flowable-engine/src/test/java/org/flowable/examples/bpmn/scripttask/ScriptTaskTest.java index 3e873b48843..2321095a5b2 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/examples/bpmn/scripttask/ScriptTaskTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/examples/bpmn/scripttask/ScriptTaskTest.java @@ -96,8 +96,11 @@ public void testErrorInScript() { assertThatThrownBy(() -> runtimeService.startProcessInstanceByKey("testErrorInScript")) .as("Starting process should result in error in script") .isInstanceOf(FlowableException.class) - .hasMessageContaining( - "Error evaluating juel script: \"execution.setVariable(\"myVar\", scriptVar)\" of activity id: theScriptTaskWithJuel of process definition id: testErrorInScript"); + .hasMessageContainingAll( + "Error evaluating juel script: \"execution.setVariable(\"myVar\", scriptVar)\" for Execution[ id", + " - definition 'testErrorInScript:1:", + " - activity 'theScriptTaskWithJuel'" + ); } /** diff --git a/modules/flowable-engine/src/test/java/org/flowable/standalone/history/FullHistoryTest.java b/modules/flowable-engine/src/test/java/org/flowable/standalone/history/FullHistoryTest.java index 78a4f25b615..8c39f6e26ae 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/standalone/history/FullHistoryTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/standalone/history/FullHistoryTest.java @@ -853,7 +853,8 @@ public void testDeleteRunningHistoricProcessInstance() { // Delete the historic process-instance, which is still running assertThatThrownBy(() -> historyService.deleteHistoricProcessInstance(processInstance.getId())) .isExactlyInstanceOf(FlowableException.class) - .hasMessageStartingWith("Process instance is still running, cannot delete historic process instance"); + .hasMessageStartingWith("Process instance is still running, cannot delete HistoricProcessInstanceEntity") + .hasMessageContaining("definition=" + processInstance.getProcessDefinitionId()); } /** diff --git a/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/DefaultOutboundEventProcessor.java b/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/DefaultOutboundEventProcessor.java index 0b6f88219fb..624a1f16e98 100644 --- a/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/DefaultOutboundEventProcessor.java +++ b/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/DefaultOutboundEventProcessor.java @@ -42,7 +42,7 @@ public DefaultOutboundEventProcessor(EventRepositoryService eventRepositoryServi @Override public void sendEvent(EventInstance eventInstance, Collection channelModels) { if (channelModels == null || channelModels.isEmpty()) { - throw new FlowableException("No channel model set for outgoing event " + eventInstance.getEventKey()); + throw new FlowableException("No channel model set for outgoing " + eventInstance); } for (ChannelModel channelModel : channelModels) { diff --git a/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/keydetector/XpathBasedInboundEventKeyDetector.java b/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/keydetector/XpathBasedInboundEventKeyDetector.java index 7d6fa0ec8cc..d950b0d312a 100644 --- a/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/keydetector/XpathBasedInboundEventKeyDetector.java +++ b/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/keydetector/XpathBasedInboundEventKeyDetector.java @@ -39,7 +39,7 @@ public String detectEventDefinitionKey(Document payload) { Node result = (Node) xPath.compile(xpathExpression).evaluate(payload, XPathConstants.NODE); return result.getTextContent(); } catch (Exception e) { - throw new FlowableException("Could not evaluate xpath expression ", e); + throw new FlowableException("Could not evaluate xpath expression " + xpathExpression, e); } } diff --git a/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/persistence/entity/data/impl/MybatisChannelDefinitionDataManager.java b/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/persistence/entity/data/impl/MybatisChannelDefinitionDataManager.java index f8a77f14193..2633d830d07 100644 --- a/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/persistence/entity/data/impl/MybatisChannelDefinitionDataManager.java +++ b/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/persistence/entity/data/impl/MybatisChannelDefinitionDataManager.java @@ -130,7 +130,7 @@ public ChannelDefinitionEntity findChannelDefinitionByKeyAndVersionAndTenantId(S if (results.size() == 1) { return results.get(0); } else if (results.size() > 1) { - throw new FlowableException("There are " + results.size() + " event definitions with key = '" + channelDefinitionKey + "' and version = '" + eventVersion + "'."); + throw new FlowableException("There are " + results.size() + " event definitions with key = '" + channelDefinitionKey + "' and version = '" + eventVersion + "' in tenant = '" + tenantId + "'."); } return null; } diff --git a/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/persistence/entity/data/impl/MybatisEventDefinitionDataManager.java b/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/persistence/entity/data/impl/MybatisEventDefinitionDataManager.java index eba6522f582..13952be4401 100644 --- a/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/persistence/entity/data/impl/MybatisEventDefinitionDataManager.java +++ b/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/persistence/entity/data/impl/MybatisEventDefinitionDataManager.java @@ -133,7 +133,7 @@ public EventDefinitionEntity findEventDefinitionByKeyAndVersionAndTenantId(Strin if (results.size() == 1) { return results.get(0); } else if (results.size() > 1) { - throw new FlowableException("There are " + results.size() + " event definitions with key = '" + eventDefinitionKey + "' and version = '" + eventVersion + "'."); + throw new FlowableException("There are " + results.size() + " event definitions with key = '" + eventDefinitionKey + "' and version = '" + eventVersion + "' in tenant = '" + tenantId + "'."); } return null; } diff --git a/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/pipeline/InboundChannelModelProcessor.java b/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/pipeline/InboundChannelModelProcessor.java index 06138efde2a..21fd0cef928 100644 --- a/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/pipeline/InboundChannelModelProcessor.java +++ b/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/pipeline/InboundChannelModelProcessor.java @@ -143,7 +143,7 @@ protected InboundEventProcessingPipeline createJsonEventProcessingPipeline(Inbou ChannelEventKeyDetection keyDetection = channelModel.getChannelEventKeyDetection(); if (keyDetection == null) { - throw new FlowableException("A channel key detection value is required"); + throw new FlowableException("A channel key detection value is required for inbound channel " + channelModel.getKey()); } if (StringUtils.isNotEmpty(keyDetection.getFixedValue())) { @@ -207,7 +207,7 @@ protected InboundEventProcessingPipeline createXmlEventProcessingPipeline(Inboun ChannelEventKeyDetection keyDetection = channelModel.getChannelEventKeyDetection(); if (keyDetection == null) { - throw new FlowableException("A channel key detection value is required"); + throw new FlowableException("A channel key detection value is required for inbound channel " + channelModel.getKey()); } if (StringUtils.isNotEmpty(keyDetection.getFixedValue())) { @@ -306,7 +306,7 @@ protected InboundEventProcessingPipeline createExpressionEventProcessingPipeline ChannelEventKeyDetection keyDetection = channelModel.getChannelEventKeyDetection(); if (keyDetection == null) { - throw new FlowableException("A channel key detection value is required"); + throw new FlowableException("A channel key detection value is required for inbound channel " + channelModel.getKey()); } if (StringUtils.isNotEmpty(keyDetection.getDelegateExpression())) { diff --git a/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/runtime/EventInstanceImpl.java b/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/runtime/EventInstanceImpl.java index 810c879d551..9b0220431b7 100644 --- a/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/runtime/EventInstanceImpl.java +++ b/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/runtime/EventInstanceImpl.java @@ -15,6 +15,7 @@ import java.util.Collection; import java.util.stream.Collectors; +import org.apache.commons.lang3.StringUtils; import org.flowable.eventregistry.api.runtime.EventInstance; import org.flowable.eventregistry.api.runtime.EventPayloadInstance; import org.flowable.eventregistry.impl.EventRegistryEngineConfiguration; @@ -90,4 +91,15 @@ public String getTenantId() { public void setTenantId(String tenantId) { this.tenantId = tenantId; } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("EventInstance[eventKey=").append(eventKey); + if (StringUtils.isNotEmpty(tenantId)) { + sb.append(", tenantId=").append(tenantId); + } + sb.append("]"); + return sb.toString(); + } } diff --git a/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/serialization/EventPayloadToJsonStringSerializer.java b/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/serialization/EventPayloadToJsonStringSerializer.java index 86dd8429d6b..fb197173967 100644 --- a/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/serialization/EventPayloadToJsonStringSerializer.java +++ b/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/serialization/EventPayloadToJsonStringSerializer.java @@ -130,7 +130,7 @@ public String serialize(EventInstance eventInstance) { try { return objectMapper.writeValueAsString(objectNode); } catch (JsonProcessingException e) { - throw new FlowableException("Could not serialize event to json string", e); + throw new FlowableException("Could not serialize event to json string for " + eventInstance, e); } } diff --git a/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/serialization/EventPayloadToXmlStringSerializer.java b/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/serialization/EventPayloadToXmlStringSerializer.java index be1aeb3f86b..f655507088b 100644 --- a/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/serialization/EventPayloadToXmlStringSerializer.java +++ b/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/serialization/EventPayloadToXmlStringSerializer.java @@ -64,7 +64,7 @@ public String serialize(EventInstance eventInstance) { return writer.toString(); } catch (Exception e) { - throw new FlowableException("Could not serialize eventInstance to xml string", e); + throw new FlowableException("XML serialization failed for " + eventInstance, e); } } diff --git a/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/tenantdetector/XpathBasedInboundEventTenantDetector.java b/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/tenantdetector/XpathBasedInboundEventTenantDetector.java index 244516cf84a..dc4123309db 100644 --- a/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/tenantdetector/XpathBasedInboundEventTenantDetector.java +++ b/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/tenantdetector/XpathBasedInboundEventTenantDetector.java @@ -39,7 +39,7 @@ public String detectTenantId(Document payload) { Node result = (Node) xPath.compile(xpathExpression).evaluate(payload, XPathConstants.NODE); return result.getTextContent(); } catch (Exception e) { - throw new FlowableException("Could not evaluate xpath expression ", e); + throw new FlowableException("Could not evaluate xpath expression " + xpathExpression, e); } } diff --git a/modules/flowable-eventsubscription-service/src/main/java/org/flowable/eventsubscription/service/impl/persistence/entity/EventSubscriptionEntityImpl.java b/modules/flowable-eventsubscription-service/src/main/java/org/flowable/eventsubscription/service/impl/persistence/entity/EventSubscriptionEntityImpl.java index c79e5c4a988..9cd9a3938e4 100644 --- a/modules/flowable-eventsubscription-service/src/main/java/org/flowable/eventsubscription/service/impl/persistence/entity/EventSubscriptionEntityImpl.java +++ b/modules/flowable-eventsubscription-service/src/main/java/org/flowable/eventsubscription/service/impl/persistence/entity/EventSubscriptionEntityImpl.java @@ -17,6 +17,7 @@ import java.util.Date; import java.util.HashMap; +import org.apache.commons.lang3.StringUtils; import org.flowable.eventsubscription.service.EventSubscriptionServiceConfiguration; /** @@ -249,4 +250,41 @@ public boolean equals(Object obj) { return true; } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName().replace("EntityImpl", "")).append("[") + .append("id=").append(id) + .append(", eventType=").append(eventType); + + if (activityId != null) { + sb.append(", activityId=").append(activityId); + } + + if (executionId != null) { + sb.append(", processInstanceId=").append(processInstanceId) + .append(", executionId=").append(executionId); + } else if (scopeId != null) { + sb.append(", scopeId=").append(scopeId) + .append(", subScopeId=").append(subScopeId) + .append(", scopeType=").append(scopeType) + .append(", scopeDefinitionId=").append(scopeDefinitionId); + } + + if (processDefinitionId != null) { + sb.append(", processDefinitionId=").append(processDefinitionId); + } else if (scopeDefinitionId != null) { + if (scopeId == null) { + sb.append(", scopeType=").append(scopeType); + } + sb.append(", scopeDefinitionId=").append(scopeDefinitionId); + } + + if (StringUtils.isNotEmpty(tenantId)) { + sb.append(", tenantId=").append(tenantId); + } + + sb.append("]"); + return sb.toString(); + } } diff --git a/modules/flowable-http-common/src/main/java/org/flowable/http/common/impl/BaseHttpActivityDelegate.java b/modules/flowable-http-common/src/main/java/org/flowable/http/common/impl/BaseHttpActivityDelegate.java index f05b349d214..9fee3f63080 100644 --- a/modules/flowable-http-common/src/main/java/org/flowable/http/common/impl/BaseHttpActivityDelegate.java +++ b/modules/flowable-http-common/src/main/java/org/flowable/http/common/impl/BaseHttpActivityDelegate.java @@ -259,7 +259,7 @@ protected HttpHeaders getRequestHeaders(VariableContainer variableContainer) { String headersString = ExpressionUtils.getStringFromField(requestHeaders, variableContainer); return HttpHeaders.parseFromString(headersString); } catch (FlowableIllegalArgumentException ex) { - throw new FlowableException(HTTP_TASK_REQUEST_HEADERS_INVALID, ex); + throw new FlowableException(HTTP_TASK_REQUEST_HEADERS_INVALID + " for " + variableContainer, ex); } } diff --git a/modules/flowable-http/src/test/java/org/flowable/http/bpmn/validation/HttpServiceTaskValidationTest.java b/modules/flowable-http/src/test/java/org/flowable/http/bpmn/validation/HttpServiceTaskValidationTest.java index f6e8a3395b7..2e34a04fb18 100644 --- a/modules/flowable-http/src/test/java/org/flowable/http/bpmn/validation/HttpServiceTaskValidationTest.java +++ b/modules/flowable-http/src/test/java/org/flowable/http/bpmn/validation/HttpServiceTaskValidationTest.java @@ -14,7 +14,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.flowable.http.common.impl.BaseHttpActivityDelegate.HTTP_TASK_REQUEST_FIELD_INVALID; -import static org.flowable.http.common.impl.BaseHttpActivityDelegate.HTTP_TASK_REQUEST_HEADERS_INVALID; import static org.flowable.http.common.impl.BaseHttpActivityDelegate.HTTP_TASK_REQUEST_METHOD_INVALID; import java.util.HashMap; @@ -43,7 +42,7 @@ public void testInvalidProcess() { public void testInvalidHeaders() { assertThatThrownBy(() -> runtimeService.startProcessInstanceByKey("invalidHeaders")) .isExactlyInstanceOf(FlowableException.class) - .hasMessage(HTTP_TASK_REQUEST_HEADERS_INVALID); + .hasMessageContainingAll("requestHeaders are invalid for Execution[", " - definition 'invalidHeaders:1:", " - activity 'httpGet'"); } @Test diff --git a/modules/flowable-identitylink-service/src/main/java/org/flowable/identitylink/service/impl/persistence/entity/HistoricIdentityLinkEntityImpl.java b/modules/flowable-identitylink-service/src/main/java/org/flowable/identitylink/service/impl/persistence/entity/HistoricIdentityLinkEntityImpl.java index dacfa52fea7..c24eb0161b1 100644 --- a/modules/flowable-identitylink-service/src/main/java/org/flowable/identitylink/service/impl/persistence/entity/HistoricIdentityLinkEntityImpl.java +++ b/modules/flowable-identitylink-service/src/main/java/org/flowable/identitylink/service/impl/persistence/entity/HistoricIdentityLinkEntityImpl.java @@ -201,4 +201,34 @@ public Date getCreateTime() { public void setCreateTime(Date createTime) { this.createTime = createTime; } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("IdentityLinkEntity[id=").append(id); + sb.append(", type=").append(type); + if (userId != null) { + sb.append(", userId=").append(userId); + } + if (groupId != null) { + sb.append(", groupId=").append(groupId); + } + if (taskId != null) { + sb.append(", taskId=").append(taskId); + } + if (processInstanceId != null) { + sb.append(", processInstanceId=").append(processInstanceId); + } + if (scopeId != null) { + sb.append(", scopeId=").append(scopeId); + } + if (scopeType != null) { + sb.append(", scopeType=").append(scopeType); + } + if (scopeDefinitionId != null) { + sb.append(", scopeDefinitionId=").append(scopeDefinitionId); + } + sb.append("]"); + return sb.toString(); + } } diff --git a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/asyncexecutor/DefaultJobManager.java b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/asyncexecutor/DefaultJobManager.java index 03ec8db8ea7..3681c9a7bef 100644 --- a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/asyncexecutor/DefaultJobManager.java +++ b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/asyncexecutor/DefaultJobManager.java @@ -334,7 +334,7 @@ public void execute(JobInfo job) { } } else { - throw new FlowableException("Only jobs with type JobEntity are supported to be executed"); + throw new FlowableException("Only jobs with type JobEntity are supported to be executed. It was " + job); } } @@ -547,16 +547,16 @@ protected void executeJobHandler(JobEntity jobEntity) { jobHandler.execute(jobEntity, jobEntity.getJobHandlerConfiguration(), variableScope, getCommandContext()); } else { throw new FlowableException("No job handler registered for type " + jobEntity.getJobHandlerType() + - " in job config for engine: " + jobServiceConfiguration.getEngineName()); + " in job config for engine: " + jobServiceConfiguration.getEngineName() + " for " + jobEntity); } } else { throw new FlowableException("No job handler registered for type " + jobEntity.getJobHandlerType() + - " in job config for engine: " + jobServiceConfiguration.getEngineName()); + " in job config for engine: " + jobServiceConfiguration.getEngineName() + " for " + jobEntity); } } else { - throw new FlowableException("Job has no job handler type in job config for engine: " + jobServiceConfiguration.getEngineName()); + throw new FlowableException(jobEntity + " has no job handler type in job config for engine: " + jobServiceConfiguration.getEngineName()); } } @@ -569,16 +569,16 @@ protected void executeHistoryJobHandler(HistoryJobEntity historyJobEntity) { jobHandler.execute(historyJobEntity, historyJobEntity.getJobHandlerConfiguration(), getCommandContext(), jobServiceConfiguration); } else { throw new FlowableException("No history job handler registered for type " + historyJobEntity.getJobHandlerType() + - " in job config for engine: " + jobServiceConfiguration.getEngineName()); + " in job config for engine: " + jobServiceConfiguration.getEngineName() + " for " + historyJobEntity); } } else { throw new FlowableException("No history job handler registered for type " + historyJobEntity.getJobHandlerType() + - " in job config for engine: " + jobServiceConfiguration.getEngineName()); + " in job config for engine: " + jobServiceConfiguration.getEngineName() + " for " + historyJobEntity); } } else { - throw new FlowableException("Async history job has no job handler type in job config for engine: " + jobServiceConfiguration.getEngineName()); + throw new FlowableException("Async " + historyJobEntity + " has no job handler type in job config for engine: " + jobServiceConfiguration.getEngineName()); } } diff --git a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/asyncexecutor/ExecuteAsyncRunnable.java b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/asyncexecutor/ExecuteAsyncRunnable.java index e3785cd3353..8fdaba45a2f 100644 --- a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/asyncexecutor/ExecuteAsyncRunnable.java +++ b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/asyncexecutor/ExecuteAsyncRunnable.java @@ -208,7 +208,7 @@ protected void handleFailedJob(final Throwable exception) { } LOGGER.error("Unable to handle exception {} for job {}.", exception, job); - throw new FlowableException("Unable to handle exception " + exception.getMessage() + " for job " + job.getId() + ".", exception); + throw new FlowableException("Unable to handle exception " + exception.getMessage() + " for " + job + ".", exception); } } diff --git a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/DeleteJobCmd.java b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/DeleteJobCmd.java index 80fa804146a..05cee5c94ef 100755 --- a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/DeleteJobCmd.java +++ b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/DeleteJobCmd.java @@ -89,7 +89,7 @@ protected JobEntity getJobToDelete(CommandContext commandContext) { // This happens if the job was already acquired, but not yet executed. // In that case, we can't allow to delete the job. if (job.getLockOwner() != null) { - throw new FlowableException("Cannot delete job when the job is being executed. Try again later."); + throw new FlowableException("Cannot delete " + job + " when the job is being executed. Try again later."); } return job; } diff --git a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/DeleteTimerJobCmd.java b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/DeleteTimerJobCmd.java index 682322e32a7..edeb3d27f58 100644 --- a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/DeleteTimerJobCmd.java +++ b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/DeleteTimerJobCmd.java @@ -80,7 +80,7 @@ protected TimerJobEntity getJobToDelete(CommandContext commandContext) { // This happens if the job was already acquired, but not yet executed. // In that case, we can't allow to delete the job. if (job.getLockOwner() != null) { - throw new FlowableException("Cannot delete timer job when the job is being executed. Try again later."); + throw new FlowableException("Cannot delete " + job + " when the job is being executed. Try again later."); } return job; } diff --git a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/ExecuteHistoryJobCmd.java b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/ExecuteHistoryJobCmd.java index ab714a62df2..e374343f858 100644 --- a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/ExecuteHistoryJobCmd.java +++ b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/ExecuteHistoryJobCmd.java @@ -60,7 +60,7 @@ public Void execute(CommandContext commandContext) { jobServiceConfiguration.getJobManager().execute(historyJobEntity); } catch (Throwable exception) { // Finally, Throw the exception to indicate the failure - throw new FlowableException("HistoryJob " + historyJobId + " failed", exception); + throw new FlowableException(historyJobEntity + " failed", exception); } return null; diff --git a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/UnacquireExternalWorkerJobCmd.java b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/UnacquireExternalWorkerJobCmd.java index db9e17f500e..fd28df39d08 100644 --- a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/UnacquireExternalWorkerJobCmd.java +++ b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/UnacquireExternalWorkerJobCmd.java @@ -51,7 +51,7 @@ public Void execute(CommandContext commandContext) { } if (!jobEntity.getLockOwner().equals(workerId)) { - throw new FlowableException("Job is locked with a different worker id"); + throw new FlowableException(jobEntity + " is locked with a different worker id"); } jobEntity.setLockExpirationTime(null); diff --git a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/AbstractJobEntityImpl.java b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/AbstractJobEntityImpl.java index 2526bc2b25a..ac667367fc0 100644 --- a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/AbstractJobEntityImpl.java +++ b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/AbstractJobEntityImpl.java @@ -390,7 +390,47 @@ protected String getEngineType() { @Override public String toString() { - return getClass().getName() + " [id=" + id + "]"; + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName().replace("Impl", "")).append("[") + .append("id=").append(id) + .append(", jobHandlerType=").append(jobHandlerType) + .append(", jobType=").append(jobType); + + if (category != null) { + sb.append(", category=").append(category); + } + + if (elementId != null) { + sb.append(", elementId=").append(elementId); + } + + if (correlationId != null) { + sb.append(", correlationId=").append(correlationId); + } + + if (executionId != null) { + sb.append(", processInstanceId=").append(processInstanceId) + .append(", executionId=").append(executionId); + } else if (scopeId != null) { + sb.append(", scopeId=").append(scopeId) + .append(", subScopeId=").append(subScopeId) + .append(", scopeType=").append(scopeType); + } + + if (processDefinitionId != null) { + sb.append(", processDefinitionId=").append(processDefinitionId); + } else if (scopeDefinitionId != null) { + if (scopeId == null) { + sb.append(", scopeType=").append(scopeType); + } + sb.append(", scopeDefinitionId=").append(scopeDefinitionId); + } + + if (StringUtils.isNotEmpty(tenantId)) { + sb.append(", tenantId=").append(tenantId); + } + sb.append("]"); + return sb.toString(); } } diff --git a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/DeadLetterJobEntityImpl.java b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/DeadLetterJobEntityImpl.java index 7d22abfcdb0..e5229caaf5c 100644 --- a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/DeadLetterJobEntityImpl.java +++ b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/DeadLetterJobEntityImpl.java @@ -21,8 +21,4 @@ public class DeadLetterJobEntityImpl extends AbstractJobEntityImpl implements De private static final long serialVersionUID = 1L; - @Override - public String toString() { - return "DeadLetterJobEntity [id=" + id + "]"; - } } diff --git a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/ExternalWorkerJobEntityImpl.java b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/ExternalWorkerJobEntityImpl.java index 2472f2dd893..01358249204 100644 --- a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/ExternalWorkerJobEntityImpl.java +++ b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/ExternalWorkerJobEntityImpl.java @@ -57,9 +57,4 @@ public void setLockExpirationTime(Date claimedUntil) { this.lockExpirationTime = claimedUntil; } - @Override - public String toString() { - return "ExternalWorkerJobEntity [id=" + id + "]"; - } - } diff --git a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/HistoryJobEntityImpl.java b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/HistoryJobEntityImpl.java index c130de01052..680d553ebf2 100644 --- a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/HistoryJobEntityImpl.java +++ b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/HistoryJobEntityImpl.java @@ -262,7 +262,19 @@ protected String getEngineType() { @Override public String toString() { - return "HistoryJobEntity [id=" + id + "]"; + StringBuilder sb = new StringBuilder(); + sb.append("HistoryJobEntity[").append("id=").append(id) + .append(", jobHandlerType=").append(jobHandlerType); + + if (scopeType != null) { + sb.append(", scopeType=").append(scopeType); + } + + if (StringUtils.isNotEmpty(tenantId)) { + sb.append(", tenantId=").append(tenantId); + } + sb.append("]"); + return sb.toString(); } } diff --git a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/JobEntityImpl.java b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/JobEntityImpl.java index 0f9814ead49..9ed064c9ce3 100644 --- a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/JobEntityImpl.java +++ b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/JobEntityImpl.java @@ -60,9 +60,4 @@ public void setLockExpirationTime(Date claimedUntil) { this.lockExpirationTime = claimedUntil; } - @Override - public String toString() { - return "JobEntity [id=" + id + "]"; - } - } diff --git a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/SuspendedJobEntityImpl.java b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/SuspendedJobEntityImpl.java index 913918e1d93..e89d6897767 100644 --- a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/SuspendedJobEntityImpl.java +++ b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/SuspendedJobEntityImpl.java @@ -21,9 +21,4 @@ public class SuspendedJobEntityImpl extends AbstractJobEntityImpl implements Sus private static final long serialVersionUID = 1L; - @Override - public String toString() { - return "SuspendedJobEntity [id=" + id + "]"; - } - } diff --git a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/TimerJobEntityImpl.java b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/TimerJobEntityImpl.java index 1e8ce553c19..f2e6ca982bc 100644 --- a/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/TimerJobEntityImpl.java +++ b/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/persistence/entity/TimerJobEntityImpl.java @@ -59,9 +59,4 @@ public void setLockExpirationTime(Date claimedUntil) { this.lockExpirationTime = claimedUntil; } - @Override - public String toString() { - return "TimerJobEntity [id=" + id + "]"; - } - } diff --git a/modules/flowable-mail/src/main/java/org/flowable/mail/common/impl/BaseMailActivityDelegate.java b/modules/flowable-mail/src/main/java/org/flowable/mail/common/impl/BaseMailActivityDelegate.java index b11bc96c377..6e633f9a2ad 100644 --- a/modules/flowable-mail/src/main/java/org/flowable/mail/common/impl/BaseMailActivityDelegate.java +++ b/modules/flowable-mail/src/main/java/org/flowable/mail/common/impl/BaseMailActivityDelegate.java @@ -110,7 +110,7 @@ protected MailMessage createMessage(V variableContainer) { String charSetStr = getStringFromField(charset, variableContainer); if (toList.isEmpty() && ccList.isEmpty() && bccList.isEmpty()) { - throw new FlowableException("No recipient could be found for sending email"); + throw new FlowableException("No recipient could be found for sending email for " + variableContainer); } if (htmlStr == null && textStr == null) { @@ -162,16 +162,16 @@ protected void addAttachments(MailMessage message, V variableContainer) { if (value instanceof Collection collection) { if (!collection.isEmpty()) { for (Object object : collection) { - addExpressionValueAttachment(message, object); + addExpressionValueAttachment(message, object, variableContainer); } } } else { - addExpressionValueAttachment(message, value); + addExpressionValueAttachment(message, value, variableContainer); } } - protected void addExpressionValueAttachment(MailMessage message, Object value) { + protected void addExpressionValueAttachment(MailMessage message, Object value, V variableContainer) { if (value instanceof File file) { if (fileExists(file)) { message.addAttachment(new FileDataSource(file)); @@ -185,12 +185,12 @@ protected void addExpressionValueAttachment(MailMessage message, Object value) { } else if (value instanceof File[] files) { for (File file : files) { - addExpressionValueAttachment(message, file); + addExpressionValueAttachment(message, file, variableContainer); } } else if (value instanceof String[] filenames) { for (String filename : filenames) { - addExpressionValueAttachment(message, filename); + addExpressionValueAttachment(message, filename, variableContainer); } } else if (value instanceof DataSource dataSource) { @@ -198,7 +198,7 @@ protected void addExpressionValueAttachment(MailMessage message, Object value) { } else if (value instanceof DataSource[] dataSources) { for (DataSource dataSource : dataSources) { - addExpressionValueAttachment(message, dataSource); + addExpressionValueAttachment(message, dataSource, variableContainer); } } else if (value instanceof ContentItem contentItem) { @@ -206,11 +206,11 @@ protected void addExpressionValueAttachment(MailMessage message, Object value) { } else if (value instanceof ContentItem[] contentItems) { for (ContentItem contentItem : contentItems) { - addExpressionValueAttachment(message, contentItem); + addExpressionValueAttachment(message, contentItem, variableContainer); } } else { - throw new FlowableException("Invalid attachment type: " + value.getClass()); + throw new FlowableException("Invalid attachment type: " + value.getClass() + " for " + variableContainer); } } diff --git a/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/persistence/entity/HistoricTaskInstanceEntityImpl.java b/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/persistence/entity/HistoricTaskInstanceEntityImpl.java index 688f5eaaf30..92bf5d110f0 100644 --- a/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/persistence/entity/HistoricTaskInstanceEntityImpl.java +++ b/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/persistence/entity/HistoricTaskInstanceEntityImpl.java @@ -653,7 +653,21 @@ protected AbstractEngineConfiguration getTaskEngineConfiguration() { @Override public String toString() { - return "HistoricTaskInstanceEntity[id=" + id + "]"; + StringBuilder strb = new StringBuilder(); + strb.append("HistoricTaskInstanceEntity["); + strb.append("id=").append(id); + strb.append(", key=").append(taskDefinitionKey); + if (executionId != null) { + strb.append(", processInstanceId=").append(processInstanceId) + .append(", executionId=").append(executionId) + .append(", processDefinitionId=").append(processDefinitionId); + } else if (scopeId != null) { + strb.append(", scopeInstanceId=").append(scopeId) + .append(", subScopeId=").append(subScopeId) + .append(", scopeDefinitionId=").append(scopeDefinitionId); + } + strb.append("]"); + return strb.toString(); } } diff --git a/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/persistence/entity/TaskEntityImpl.java b/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/persistence/entity/TaskEntityImpl.java index 127a69b8977..e924fc7ed91 100644 --- a/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/persistence/entity/TaskEntityImpl.java +++ b/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/persistence/entity/TaskEntityImpl.java @@ -430,7 +430,7 @@ protected boolean isPropagateToHistoricVariable() { protected VariableInstanceEntity getSpecificVariable(String variableName) { CommandContext commandContext = Context.getCommandContext(); if (commandContext == null) { - throw new FlowableException("lazy loading outside command context"); + throw new FlowableException("lazy loading outside command context for " + this); } return getVariableServiceConfiguration().getVariableService() @@ -444,7 +444,7 @@ protected VariableInstanceEntity getSpecificVariable(String variableName) { protected List getSpecificVariables(Collection variableNames) { CommandContext commandContext = Context.getCommandContext(); if (commandContext == null) { - throw new FlowableException("lazy loading outside command context"); + throw new FlowableException("lazy loading outside command context for " + this); } return getVariableServiceConfiguration().getVariableService() .createInternalVariableInstanceQuery() @@ -952,7 +952,22 @@ public void setQueryIdentityLinks(List identityLinks) { @Override public String toString() { - return "Task[id=" + id + ", key=" + taskDefinitionKey + ", name=" + name + "]"; + StringBuilder strb = new StringBuilder(); + strb.append("Task["); + strb.append("id=").append(id); + strb.append(", key=").append(taskDefinitionKey); + strb.append(", name=").append(name); + if (executionId != null) { + strb.append(", processInstanceId=").append(processInstanceId) + .append(", executionId=").append(executionId) + .append(", processDefinitionId=").append(processDefinitionId); + } else if (scopeId != null) { + strb.append(", scopeInstanceId=").append(scopeId) + .append(", subScopeId=").append(subScopeId) + .append(", scopeDefinitionId=").append(scopeDefinitionId); + } + strb.append("]"); + return strb.toString(); } @Override diff --git a/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/persistence/entity/VariableInstanceEntityImpl.java b/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/persistence/entity/VariableInstanceEntityImpl.java index 3e04f85edb3..a7905e9f404 100644 --- a/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/persistence/entity/VariableInstanceEntityImpl.java +++ b/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/persistence/entity/VariableInstanceEntityImpl.java @@ -324,6 +324,27 @@ public String toString() { sb.append("id=").append(id); sb.append(", name=").append(name); sb.append(", type=").append(type != null ? type.getTypeName() : "null"); + if (executionId != null) { + sb.append(", executionId=").append(executionId); + } + if (processInstanceId != null) { + sb.append(", processInstanceId=").append(processInstanceId); + } + if (processDefinitionId != null) { + sb.append(", processDefinitionId=").append(processDefinitionId); + } + if (scopeId != null) { + sb.append(", scopeId=").append(scopeId); + } + if (subScopeId != null) { + sb.append(", subScopeId=").append(subScopeId); + } + if (scopeType != null) { + sb.append(", scopeType=").append(scopeType); + } + if (scopeDefinitionId != null) { + sb.append(", scopeDefinitionId=").append(scopeDefinitionId); + } if (longValue != null) { sb.append(", longValue=").append(longValue); } diff --git a/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/persistence/entity/VariableScopeImpl.java b/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/persistence/entity/VariableScopeImpl.java index 9513d7beb55..7e3963dc2cd 100644 --- a/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/persistence/entity/VariableScopeImpl.java +++ b/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/persistence/entity/VariableScopeImpl.java @@ -73,7 +73,7 @@ protected void ensureVariableInstancesInitialized() { CommandContext commandContext = Context.getCommandContext(); if (commandContext == null) { - throw new FlowableException("lazy loading outside command context"); + throw new FlowableException("lazy loading outside command context for " + this); } Collection variableInstancesList = loadVariableInstances(); for (VariableInstanceEntity variableInstance : variableInstancesList) { @@ -791,7 +791,7 @@ protected void createVariableLocal(String variableName, Object value) { ensureVariableInstancesInitialized(); if (variableInstances.containsKey(variableName)) { - throw new FlowableException("variable '" + variableName + "' already exists. Use setVariableLocal if you want to overwrite the value"); + throw new FlowableException("variable '" + variableName + "' already exists. Use setVariableLocal if you want to overwrite the value for " + this); } createVariableInstance(variableName, value);