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

Andrey Turbanov aturbanov at openjdk.java.net
Wed Jun 1 13:35:45 UTC 2022


On Wed, 1 Jun 2022 04:08:53 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8287390: Cleanup Map usage in AuthenticationInfo.requestAuthentication
>>   remove obvious assert
>
> 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.

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

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


More information about the net-dev mailing list