Bug 781046 (SOA-3532)

Summary: jBPM 3.2.x 2 allows user to deploy process instances with 2 nodes same name, stack trace isn't helpful
Product: [JBoss] JBoss Enterprise SOA Platform 4 Reporter: Rick Wagner <rwagner>
Component: unspecifiedAssignee: Mark Little <mark.little>
Status: MODIFIED --- QA Contact: Matej Melko <mmelko>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.3 CP04 GA   
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: http://jira.jboss.org/jira/browse/SOA-3532
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
All jBPM 3.2.x
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Rick Wagner 2011-10-28 21:03:35 UTC
Complexity: High
Help Desk Ticket Reference: https://c.na7.visual.force.com/apex/Case_View?id=500A0000008TN29&sfdc.override=1
Steps to Reproduce: Use a process like the one included above, deploy it.
project_key: SOA

If the user tries to deploy a Process definition where 2 nodes have the same name, an unhelpful stack trace results.

The recursion occurs due to the use of ArrayList.indexOf:
      int index = nodeCollection.getNodes().indexOf(this);
The indexOf method calls equals() on its parameter ("this" in this case).


Example:
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<process-definition  xmlns=""  name="SimpleProcess">
	<start-state name="start-state1">
		<transition to="node1"></transition>
	</start-state>
	<node name="node1">
		<action class="com.sample.action.MessageActionHandler" name="Node1Action">
			<message>
				Hey I'm Node1
			</message>
		</action>
		<transition to="node"></transition>
	</node>
    <!--  Renamed this from 'node2' to see if recursion happens.... -->
	<node name="node1">
		<action class="com.sample.action.MessageActionHandler" name="Node2Action">
			<message>
				Hey I'm Node2
			</message>
		</action>
		<transition to="end-state1"></transition>
	</node>
	<end-state name="end-state1"></end-state>
</process-definition>
{code}

----
_*The stack trace*_

{noformat}
javax.servlet.ServletException: Servlet execution threw an exception
	org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
{noformat}

root cause

{noformat}
java.lang.StackOverflowError
	org.jbpm.graph.def.GraphElement.equals(GraphElement.java:442)
	java.util.ArrayList.indexOf(ArrayList.java:216)
	org.jbpm.graph.def.GraphElement.equals(GraphElement.java:457)
	java.util.ArrayList.indexOf(ArrayList.java:216)
	org.jbpm.graph.def.GraphElement.equals(GraphElement.java:457)
	java.util.ArrayList.indexOf(ArrayList.java:216)
	org.jbpm.graph.def.GraphElement.equals(GraphElement.java:457)
	java.util.ArrayList.indexOf(ArrayList.java:216)
	org.jbpm.graph.def.GraphElement.equals(GraphElement.java:457)
	java.util.ArrayList.indexOf(ArrayList.java:216)
	org.jbpm.graph.def.GraphElement.equals(GraphElement.java:457)
	java.util.ArrayList.indexOf(ArrayList.java:216)
	org.jbpm.graph.def.GraphElement.equals(GraphElement.java:457)
{noformat}
(Etc, etc)

Comment 1 (please assign to mrietvel@redhat.com) 2011-11-02 11:39:11 UTC
Complexity: Added: High


Comment 2 (please assign to mrietvel@redhat.com) 2011-11-02 11:41:10 UTC
Link: Added: This issue Cloned to JBPM-3423