1 Reply Latest reply on Feb 7, 2006 6:55 PM by Jim McMaster

    jBPM incorrectly accumulating variables for child token

    Jim McMaster Newbie

      I have a process which forks child tokens to handle parts of the processing. Each node in the process sets a "status" variable to indicate success or failure. Prior to the fork, a node set a STATUS_SUCCESS, then the children are forked off.

      One of the children invokes a node which sets the status to STATUS_FAILURE, and invokes:

      contextInstance.addVariables(variables, childToken)


      At this point, the ContextInstance has two entries in TokenVariableMap, one for the parent and one for the child. Each variable map contains a status variable, but the values are different.

      Later, I invoke:

      contextInstance.getVariables(token)


      When the variables come back, the status varable has the value STATUS_SUCCESS. In TokenVariableMap.collectAllVariables, the code gets all the variables for the child token, then adds the variables for the parent. This is great, except it does not check to see if the variable already exists in the HashMap, so the parent value overlays the child's.

      I think this might be a bug. Should I open a problem report?