Strange flow variable behavior


I'm experiencing what I think is unexpected behavior with regard to workflow variables (version 2.5.2 64-bit). I create a workflow variable (myTestVar) using the Java Edit Variable node and assign it the value "big bird", then attempt to modify that variable using another Java Edit Variable node (java code = return "elmo"; and I select "Overwrite" and the myTestVar node).

However, when the variable is then injected back into the workflow, there appear to be two myTestVar variables, reflecting the two different values (as displayed in the Flow Variables tab of the Inject Variables node). If I then use a Java Snippet to write the value of the variable to a new column, the dialog only exposes a single myTestVar in the variables list and writes out the value as assigned in the first Java Edit Variable node (big bird), and not the updated value (elmo) as I expected.

If I create a similar workflow but bypass the two initial extract and inject variables nodes by hooking up the two Edit Java Variable nodes directly, it still appears as if I have two variables in the final inject variables nodes, but this time the final Java Snippet node writes out the updated value of the variable (elmo).

It seems as if the Inject and/or Extract Variable nodes are responsible for this strange behavior.

I attached a workflow exhibiting this behavior.


This definitely seems like a bug with the Java Edit Variable to me. There should surely not be two instances of the same variable name. The node is set to overwrite the existing variable but this clearly isnt taking place. If you view the flow variable properties in the output of the Java Edit Variable it shows both instances with the same name.

I know BigBird is big, but it should still be possible to replace with little Elmo!


Yes, I think you're right, Simon. The Java Edit Variable node should not create 2 instances of the variable.

By the way if you select "Define Variable" instead of "Overwrite Variable" in the second Java Edit Variable node, the behavior is exactly the same: two variables with the same name, but different values. I would think this should have produced an error in the second node or perhaps just overwritten the value of the first variable along with a warning that the var already exists.

Unfortunately, this bug is causing real issues in some of my workflows. Thanks for having a look though.

Dear Don:

The behavior that you are seeing is expected. I commented on the variable handling in another forum post (

If you read my post and map it to your workflow you will notice that "elmo" is defined on the second input of the "Inject Variables" node. As a variable with the same identifier is also defined at the 1st input that variable takes precedence (value "big bird"). The solution is simply: Either you take a workflow as outlined in the bottom part of your workflow or you don't use the "Inject Variables" at all but make use of the "Flow Variable Ports" that you can enable through a node's context menu.

Hope that helps!


Thanks Bernd, I understand now. I added a comment on your other post.