Skip to content

Commit

Permalink
Always create a new HashMap when changing the immutable extension met…
Browse files Browse the repository at this point in the history
…adata
  • Loading branch information
gastaldi committed Jul 19, 2021
1 parent 24e6793 commit b0feb74
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,9 @@ public static ExtensionCatalog resolvePlatformDescriptorDirectly(String bomGroup
}

final OriginPreference originPreference = new OriginPreference(1, 1, 1, ++memberIndex, 1);
Map<String, Object> metadata = memberCatalog.getMetadata();
if (metadata.isEmpty()) {
metadata = new HashMap<>();
((JsonExtensionCatalog) memberCatalog).setMetadata(metadata);
}
Map<String, Object> metadata = new HashMap<>(memberCatalog.getMetadata());
metadata.put("origin-preference", originPreference);

((JsonExtensionCatalog) memberCatalog).setMetadata(metadata);
catalogs.add(memberCatalog);
}
catalog = JsonCatalogMerger.merge(catalogs);
Expand Down

0 comments on commit b0feb74

Please sign in to comment.