This is an automated email from the ASF dual-hosted git repository.

mweiler pushed a commit to branch main
in repository 
https://gitbox.apache.org/repos/asf/incubator-kie-kogito-runtimes.git


The following commit(s) were added to refs/heads/main by this push:
     new 164b5dff74 Fix for failing async node pointing to wrong nodeinstance 
id (#4136)
164b5dff74 is described below

commit 164b5dff74a5dd9cf18c5026d1f9b2ed7cae7c6d
Author: Deepak Joseph <[email protected]>
AuthorDate: Fri Nov 28 04:44:33 2025 +0530

    Fix for failing async node pointing to wrong nodeinstance id (#4136)
---
 .../jbpm/workflow/core/node/AsyncEventNodeInstance.java  |  9 +++++++++
 .../jbpm/workflow/instance/impl/NodeInstanceImpl.java    | 16 +++++++++++-----
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git 
a/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/core/node/AsyncEventNodeInstance.java
 
b/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/core/node/AsyncEventNodeInstance.java
index 77fdaf85ff..55205dad2a 100644
--- 
a/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/core/node/AsyncEventNodeInstance.java
+++ 
b/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/core/node/AsyncEventNodeInstance.java
@@ -37,6 +37,7 @@ import org.kie.kogito.jobs.JobsService;
 import org.kie.kogito.jobs.TimerDescription;
 import org.kie.kogito.jobs.descriptors.ProcessInstanceJobDescription;
 import org.kie.kogito.process.ProcessInstance;
+import org.kie.kogito.process.ProcessInstanceExecutionException;
 import org.kie.kogito.services.uow.BaseWorkUnit;
 import org.kie.kogito.timer.TimerInstance;
 import org.kie.kogito.uow.WorkUnit;
@@ -195,4 +196,12 @@ public class AsyncEventNodeInstance extends 
EventNodeInstance {
         triggerNodeInstance((org.jbpm.workflow.instance.NodeInstance) 
actualInstance, org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE);
         clearAsyncStatus();
     }
+
+    @Override
+    protected void wrapException(ProcessInstanceExecutionException 
executionException) {
+        logger.debug("Exception already wrapped by node instance '{}' (node 
'{}' id: '{}') in process instance '{}' (process: '{}')... propagating 
exception.", getStringId(),
+                getNodeName(),
+                getNodeDefinitionId(), getProcessInstance().getId(), 
getProcessInstance().getProcessId());
+        throw executionException;
+    }
 }
diff --git 
a/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/impl/NodeInstanceImpl.java
 
b/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/impl/NodeInstanceImpl.java
index 3ba12c2e66..6db271f963 100755
--- 
a/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/impl/NodeInstanceImpl.java
+++ 
b/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/impl/NodeInstanceImpl.java
@@ -265,11 +265,8 @@ public abstract class NodeInstanceImpl implements 
org.jbpm.workflow.instance.Nod
                 captureError(e);
             } else {
                 // Checking if the exception has been already wrapped by the 
actual node instance to avoid unnecessary wrappings.
-                if (e instanceof ProcessInstanceExecutionException 
executionException && 
getId().equals(executionException.getFailedNodeInstanceId())) {
-                    logger.debug("Exception already wrapped by node instance 
'{}' (node '{}' id: '{}') in process instance '{}' (process: '{}')... 
propagating exception.", getStringId(),
-                            getNodeName(),
-                            getNodeDefinitionId(), processInstance.getId(), 
processInstance.getProcessId());
-                    throw executionException;
+                if (e instanceof ProcessInstanceExecutionException 
executionException) {
+                    wrapException(executionException);
                 }
                 logger.error("Error {} executing node instance '{}' (node '{}' 
id: '{}') in process instance '{}' (process: '{}') in a transactional 
environment (Wrapping)", e.getMessage(),
                         getStringId(), getNodeName(),
@@ -279,6 +276,15 @@ public abstract class NodeInstanceImpl implements 
org.jbpm.workflow.instance.Nod
         }
     }
 
+    protected void wrapException(ProcessInstanceExecutionException 
executionException) {
+        if (getId().equals(executionException.getFailedNodeInstanceId())) {
+            logger.debug("Exception already wrapped by node instance '{}' 
(node '{}' id: '{}') in process instance '{}' (process: '{}')... propagating 
exception.", getStringId(),
+                    getNodeName(),
+                    getNodeDefinitionId(), processInstance.getId(), 
processInstance.getProcessId());
+            throw executionException;
+        }
+    }
+
     protected void captureError(Exception e) {
         getProcessInstance().setErrorState(this, e);
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to