8288329: Avoid redundant TreeMap.containsKey call in PolicyParser.read

Reviewed-by: mullan
This commit is contained in:
Andrey Turbanov 2022-06-20 08:03:13 +00:00
parent f62b2bd9cd
commit 7acdcc1034

View file

@ -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
@ -202,9 +202,7 @@ public class PolicyParser {
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};