JBoss Community

Re: JBPM 3.1 Exception thrown on EndState

created by Al Daher in jBPM - View the full discussion

i analysed the log Information, there was something suspicious happening in my process.

The process cgoes as follows:

Start---->validateNode(actionhandler1)---->decisionNodeUponValidation(actionhandler2)----->End\or go further

in actionHandler1 ihad the following code:

Line1 if(startDate.before(currentDate))

Line2        {

Line3            executionContext.setVariable(ProjectManagementProcessConstants.VAR_PROJECT_STATUS, Status.REJECTED);

Line4            executionContext.leaveNode();

Line5        }

Line6        else if(projecttitle==null || projecttitle.equals(""))

Line7        {

Line8            executionContext.setVariable(ProjectManagementProcessConstants.VAR_PROJECT_STATUS, Status.REJECTED);

Line9            executionContext.leaveNode();

Line10        }

Line11        executionContext.setVariable(ProjectManagementProcessConstants.VAR_PROJECT_STATUS, Status.APPROVED);

Line12        executionContext.leaveNode();

 

according my test, it shall go through line 3 and 4 and after that actionhandler2 shall be called and then to endState will be reached. So fas so good. And it happens indeed BUT:

after getting out of End State the code completes to line 11 and 12 in actionHandler1. Now the Variable Status is has changed But actionHandler1 has not finished. So while leaving EndState it goes furrther in actionHandler1 and actionHandler2. in actionHandler2 it fires a a leavenode(transition1) and tries to go to a transition1 which does not exist in End State. Hence the exception can't leave node 'EndState(endProjectManagementProcess)' without leaving transition.

 

Bottom Line: LEAVENODE FUNCTION IS NOT THE SAME AS RETURN

That is something NEW AND INTERESTING to learn

Reply to this message by going to Community

Start a new discussion in jBPM at Community