This is an automated email from the ASF dual-hosted git repository.
martinweiler pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie.git
The following commit(s) were added to refs/heads/main by this push:
new 385c4e0658e [incubator-kie#7219] Process variable with an empty
structureRef fails to build (#7225)
385c4e0658e is described below
commit 385c4e0658e4de8136fcdec9abe54bc0796e37ec
Author: Abhiram Gundala <[email protected]>
AuthorDate: Wed Oct 28 09:42:19 2026 -0400
[incubator-kie#7219] Process variable with an empty structureRef fails to
build (#7225)
---
.../process/core/datatype/DataTypeResolver.java | 2 +-
.../core/datatype/DataTypeResolverTest.java | 1 +
.../jbpm/bpmn2/data/BPMN2-EmptyStructureRef.bpmn2 | 77 ++++++++++++++++++++++
.../src/test/java/org/jbpm/bpmn2/DataTest.java | 15 +++++
4 files changed, 94 insertions(+), 1 deletion(-)
diff --git
a/kogito-jbpm/jbpm-flow/src/main/java/org/jbpm/process/core/datatype/DataTypeResolver.java
b/kogito-jbpm/jbpm-flow/src/main/java/org/jbpm/process/core/datatype/DataTypeResolver.java
index c696cd0ee5f..5635d3f3969 100644
---
a/kogito-jbpm/jbpm-flow/src/main/java/org/jbpm/process/core/datatype/DataTypeResolver.java
+++
b/kogito-jbpm/jbpm-flow/src/main/java/org/jbpm/process/core/datatype/DataTypeResolver.java
@@ -56,7 +56,7 @@ public class DataTypeResolver {
}
public static DataType fromType(String type, ClassLoader cl) {
- return type == null ? defaultDataType : from(type, cl);
+ return type == null || type.trim().isEmpty() ? defaultDataType :
from(type, cl);
}
public static DataType fromClass(Class<?> clazz) {
diff --git
a/kogito-jbpm/jbpm-flow/src/test/java/org/jbpm/process/core/datatype/DataTypeResolverTest.java
b/kogito-jbpm/jbpm-flow/src/test/java/org/jbpm/process/core/datatype/DataTypeResolverTest.java
index c5fa029d070..25542088b0f 100644
---
a/kogito-jbpm/jbpm-flow/src/test/java/org/jbpm/process/core/datatype/DataTypeResolverTest.java
+++
b/kogito-jbpm/jbpm-flow/src/test/java/org/jbpm/process/core/datatype/DataTypeResolverTest.java
@@ -69,6 +69,7 @@ public class DataTypeResolverTest {
assertThat(DataTypeResolver.fromType("Float",
cl)).isInstanceOf(FloatDataType.class);
assertThat(DataTypeResolver.fromType("java.util.List",
cl)).isInstanceOf(ListDataType.class);
assertThat(DataTypeResolver.fromType("Object",
cl)).isInstanceOf(ObjectDataType.class);
+ assertThat(DataTypeResolver.fromType("",
cl).getStringType()).isEqualTo("java.lang.Object");
assertThat(DataTypeResolver.fromType(Others.class.getName(),
cl)).isInstanceOf(EnumDataType.class);
}
}
diff --git
a/kogito-jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/data/BPMN2-EmptyStructureRef.bpmn2
b/kogito-jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/data/BPMN2-EmptyStructureRef.bpmn2
new file mode 100644
index 00000000000..46b7e5ae8b2
--- /dev/null
+++
b/kogito-jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/data/BPMN2-EmptyStructureRef.bpmn2
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<definitions id="Definition"
+ targetNamespace="http://www.example.org/EvaluationExample"
+ typeLanguage="http://www.java.com/javaTypes"
+ expressionLanguage="http://www.mvel.org/2.0"
+ xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL
BPMN20.xsd"
+ xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
+ xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
+ xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
+ xmlns:tns="http://www.jboss.org/drools">
+
+ <itemDefinition id="_myVarItem" structureRef="" />
+
+ <process processType="Private" isExecutable="true" id="EmptyStructureRef"
name="Empty StructureRef Process" tns:packageName="org.jbpm.bpmn2.data">
+
+ <!-- process variables -->
+ <property id="myVar" itemSubjectRef="_myVarItem"/>
+
+ <!-- nodes -->
+ <startEvent id="_1" name="StartProcess" />
+ <scriptTask id="_2" name="Log" >
+ <script>System.out.println("Process started with variable value: " +
myVar);</script>
+ </scriptTask>
+ <endEvent id="_3" name="EndProcess" >
+ <terminateEventDefinition/>
+ </endEvent>
+
+ <!-- connections -->
+ <sequenceFlow id="_1-_2" sourceRef="_1" targetRef="_2" />
+ <sequenceFlow id="_2-_3" sourceRef="_2" targetRef="_3" />
+
+ </process>
+
+ <bpmndi:BPMNDiagram>
+ <bpmndi:BPMNPlane bpmnElement="EmptyStructureRef" >
+ <bpmndi:BPMNShape bpmnElement="_1" >
+ <dc:Bounds x="16" y="16" width="48" height="48" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape bpmnElement="_2" >
+ <dc:Bounds x="96" y="16" width="80" height="48" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape bpmnElement="_3" >
+ <dc:Bounds x="208" y="16" width="48" height="48" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge bpmnElement="_1-_2" >
+ <di:waypoint x="40" y="40" />
+ <di:waypoint x="136" y="40" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge bpmnElement="_2-_3" >
+ <di:waypoint x="136" y="40" />
+ <di:waypoint x="232" y="40" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+
+</definitions>
\ No newline at end of file
diff --git a/kogito-jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/DataTest.java
b/kogito-jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/DataTest.java
index 052c58bb8f3..fb3023fa4ba 100755
--- a/kogito-jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/DataTest.java
+++ b/kogito-jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/DataTest.java
@@ -54,6 +54,8 @@ import org.jbpm.bpmn2.data.DataOutputAssociationsModel;
import org.jbpm.bpmn2.data.DataOutputAssociationsProcess;
import org.jbpm.bpmn2.data.DataOutputAssociationsXmlNodeModel;
import org.jbpm.bpmn2.data.DataOutputAssociationsXmlNodeProcess;
+import org.jbpm.bpmn2.data.EmptyStructureRefModel;
+import org.jbpm.bpmn2.data.EmptyStructureRefProcess;
import org.jbpm.bpmn2.data.Evaluation2Model;
import org.jbpm.bpmn2.data.Evaluation2Process;
import org.jbpm.bpmn2.data.Evaluation3Model;
@@ -112,6 +114,19 @@ public class DataTest extends JbpmBpmn2TestCase {
}
+ @Test
+ public void testEmptyStructureRef() {
+ Application app = ProcessTestHelper.newApplication();
+ org.kie.kogito.process.Process<EmptyStructureRefModel> process =
EmptyStructureRefProcess.newProcess(app);
+ EmptyStructureRefModel model = process.createModel();
+ model.setMyVar("test value");
+ ProcessInstance<EmptyStructureRefModel> processInstance =
process.createInstance(model);
+ processInstance.start();
+
+
assertThat(processInstance.status()).isEqualTo(org.jbpm.process.instance.ProcessInstance.STATE_COMPLETED);
+ assertThat(processInstance.variables().getMyVar()).isEqualTo("test
value");
+ }
+
@Test
public void testDataStore() throws Exception {
kruntime =
createKogitoProcessRuntime("org/jbpm/bpmn2/data/BPMN2-DataStore.bpmn2");
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]