Skip to content

Commit

Permalink
[Fix apache#3513] Different jsonnode instance for parent and children…
Browse files Browse the repository at this point in the history
… process
  • Loading branch information
fjtirado committed May 13, 2024
1 parent 4a7e77d commit bcf4451
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;

public class JsonNodeModel implements Model, MapInput, MapInputId, MapOutput, MappableToModel<JsonNodeModelOutput> {

Expand Down Expand Up @@ -94,7 +95,11 @@ public Map<String, Object> updatePartially(Map<String, Object> params) {
private void update(Map<String, Object> params, Function<JsonNode, JsonNode> merger) {
if (params.containsKey(SWFConstants.DEFAULT_WORKFLOW_VAR)) {
params = mutableMap(params);
this.workflowdata = merger.apply(JsonObjectUtils.fromValue(params.remove(SWFConstants.DEFAULT_WORKFLOW_VAR)));
Object workflowVar = params.remove(SWFConstants.DEFAULT_WORKFLOW_VAR);
if (workflowVar instanceof JsonNode) {
workflowVar = ((JsonNode) workflowVar).deepCopy();
}
this.workflowdata = merger.apply(JsonObjectUtils.fromValue(workflowVar));
this.additionalProperties = params;
} else {
this.workflowdata = merger.apply(JsonObjectUtils.fromValue(params));
Expand Down

0 comments on commit bcf4451

Please sign in to comment.