Skip to content

Commit

Permalink
fix(policies): fix concurrent modification exception (#8681)
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanHolstien authored Aug 24, 2023
1 parent 9472636 commit aab5b6a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,11 @@ private void addPoliciesToCache(final Map<String, List<DataHubPolicyInfo>> cache
private void addPolicyToCache(final Map<String, List<DataHubPolicyInfo>> cache, final DataHubPolicyInfo policy) {
final List<String> privileges = policy.getPrivileges();
for (String privilege : privileges) {
List<DataHubPolicyInfo> existingPolicies = cache.getOrDefault(privilege, new ArrayList<>());
List<DataHubPolicyInfo> existingPolicies = cache.containsKey(privilege) ? new ArrayList<>(cache.get(privilege)) : new ArrayList<>();
existingPolicies.add(policy);
cache.put(privilege, existingPolicies);
}
List<DataHubPolicyInfo> existingPolicies = cache.getOrDefault(ALL, new ArrayList<>());
List<DataHubPolicyInfo> existingPolicies = cache.containsKey(ALL) ? new ArrayList<>(cache.get(ALL)) : new ArrayList<>();
existingPolicies.add(policy);
cache.put(ALL, existingPolicies);
}
Expand Down

0 comments on commit aab5b6a

Please sign in to comment.