On Fri, 17 Oct 2025 17:49:11 GMT, Artur Barashev <[email protected]> wrote:

>> Mikhail Yankelevich has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Artur's comments
>
> src/java.base/share/classes/sun/security/ssl/X509KeyManagerImpl.java line 234:
> 
>> 232:             if (SSLLogger.isOn && SSLLogger.isOn("keymanager")) {
>> 233:                 SSLLogger.warning("Invalid alias format: " + alias);
>> 234:             }
> 
> Since the 2nd `indexOf` method actually doesn't throw Out Of Bounds exception 
> if the 2nd argument is larger than the string's length (it returns `-1` 
> instead), we can simplify this code:
> 
>         int firstDot = alias.indexOf('.');
>         int secondDot = alias.indexOf('.', firstDot + 1);
> 
>         if (firstDot < 1 || secondDot - firstDot < 2
>                 || alias.length() - secondDot < 2) {
>             if (SSLLogger.isOn && SSLLogger.isOn("keymanager")) {
>                 SSLLogger.warning("Invalid alias format: " + alias);
>             }
>             return null;
>         }

Done in the next commit

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27851#discussion_r2442497146

Reply via email to