On Thu, 20 Feb 2025 17:32:54 GMT, Sergey Chernyshev <schernys...@openjdk.org> 
wrote:

>> src/java.base/linux/classes/jdk/internal/platform/cgroupv1/CgroupV1SubsystemController.java
>>  line 73:
>> 
>>> 71:                                 break;
>>> 72:                             }
>>> 73:                             cgp = (cgp.getNameCount() > 1) ? 
>>> cgp.subpath(1, cgp.getNameCount()) : Path.of("");
>> 
>> Suggestion:
>> 
>>                             cgp = (nameCount > 1) ? cgp.subpath(1, 
>> nameCount) : Path.of("");
>
> Good catch, but as long as cgp#nameCount may change in the loop, this exact 
> patch i cannot take.

How about this?

int currentNameCount = cgp.getNameCount();
cgp = (currentNameCount > 1) ? cgp.subpath(1, currentNameCount) : Path.of("");

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21808#discussion_r1966107031

Reply via email to