RFR: 8287390: Cleanup Map usage in AuthenticationInfo.requestAuthentication [v2]

Jaikiran Pai jpai at openjdk.java.net
Wed Jun 1 13:35:46 UTC 2022


On Wed, 1 Jun 2022 13:27:27 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

>> src/java.base/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java line 159:
>> 
>>> 157:             if (t == null || t == c) {
>>> 158:                 assert cached == null;
>>> 159:                 return cached;
>> 
>> Hello Andrey, while you are in this code, I think changing these 2 lines:
>> 
>> 
>> assert cached == null;
>> return cached;
>> 
>> to just:
>> 
>> 
>> return null;
>> 
>> would be better. There's already a `if (cached != null) return cached;` code, a few lines above and after that line there's no other modifications to this `cached` local variable, so changing this line to just return null would remove any confusion while reading this code.
>
> Good idea. Updated.

Thank you for that change. The changes in this PR looks fine to me.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8484


More information about the net-dev mailing list