Skip to content

Commit

Permalink
8288329: Avoid redundant TreeMap.containsKey call in PolicyParser.read
Browse files Browse the repository at this point in the history
Reviewed-by: mullan
  • Loading branch information
Andrey Turbanov committed Jun 20, 2022
1 parent f62b2bd commit 7acdcc1
Showing 1 changed file with 2 additions and 4 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -202,9 +202,7 @@ public void read(Reader policy)
DomainEntry de = parseDomainEntry();
if (de != null) {
String domainName = de.getName();
if (!domainEntries.containsKey(domainName)) {
domainEntries.put(domainName, de);
} else {
if (domainEntries.putIfAbsent(domainName, de) != null) {
LocalizedMessage localizedMsg = new LocalizedMessage(
"duplicate.keystore.domain.name");
Object[] source = {domainName};
Expand Down

1 comment on commit 7acdcc1

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.