Skip to content

Commit

Permalink
Create mutable copies in BaseProcessor
Browse files Browse the repository at this point in the history
  • Loading branch information
robertpanzer committed Jun 18, 2023
1 parent e1baca9 commit cfa68db
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,10 @@ public Block createBlock(StructuralNode parent, String context, String content,

@Override
public Block createBlock(StructuralNode parent, String context, String content, Map<String, Object> attributes, Map<Object, Object> options) {
options.put(Options.SOURCE, content);
options.put(Options.ATTRIBUTES, attributes);
return createBlock(parent, context, options);
Map<Object, Object> optionsCopy = new HashMap<>(options);
optionsCopy.put(Options.SOURCE, content);
optionsCopy.put(Options.ATTRIBUTES, attributes);
return createBlock(parent, context, optionsCopy);
}

@Override
Expand All @@ -237,11 +238,11 @@ public Block createBlock(StructuralNode parent, String context, List<String> con
@Override
public Block createBlock(StructuralNode parent, String context, List<String> content, Map<String, Object> attributes,
Map<Object, Object> options) {
Map<Object, Object> optionsCopy = new HashMap<>(options);
optionsCopy.put(Options.SOURCE, content);
optionsCopy.put(Options.ATTRIBUTES, new HashMap<>(attributes));

options.put(Options.SOURCE, content);
options.put(Options.ATTRIBUTES, new HashMap<>(attributes));

return createBlock(parent, context, options);
return createBlock(parent, context, optionsCopy);
}

@Override
Expand Down

0 comments on commit cfa68db

Please sign in to comment.