From ce5024f66fb21400cbb619064d4f0d19849faab4 Mon Sep 17 00:00:00 2001 From: Andrey Turbanov Date: Thu, 16 Jun 2022 16:03:05 +0000 Subject: [PATCH] 8288468: Avoid redundant HashMap.get call in NegotiateAuthentication.firstToken Reviewed-by: dfuchs, jpai --- .../sun/net/www/protocol/http/NegotiateAuthentication.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/java.base/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java b/src/java.base/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java index 9ce02643b57..5ca76f1c196 100644 --- a/src/java.base/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java +++ b/src/java.base/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java @@ -216,12 +216,9 @@ class NegotiateAuthentication extends AuthenticationInfo { */ private byte[] firstToken() throws IOException { negotiator = null; - HashMap cachedMap = getCache(); + HashMap cachedMap = getCache(); if (cachedMap != null) { - negotiator = cachedMap.get(getHost()); - if (negotiator != null) { - cachedMap.remove(getHost()); // so that it is only used once - } + negotiator = cachedMap.remove(getHost()); // so that it is only used once } if (negotiator == null) { negotiator = Negotiator.getNegotiator(hci);