[jdk8u-dev] RFR: 8287107: CgroupSubsystemFactory.setCgroupV2Path asserts with freezer controller [v2]
Andrew John Hughes
andrew at openjdk.org
Mon Jan 30 15:50:30 UTC 2023
On Fri, 27 Jan 2023 22:04:49 GMT, Andrew John Hughes <andrew at openjdk.org> wrote:
>> Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains one commit:
>>
>> 8287107: CgroupSubsystemFactory.setCgroupV2Path asserts with freezer controller
>>
>> Backport-of: 704b9a66bba0dc8adb62be80fd62864b9c687c3f
>
> I think it should be `Files.writeString(a, b) => Files.write(a, b.getBytes(StandardCharsets.UTF_8))` rather than `Files.writeString(a, b) => Files.write(a, b.getBytes())`. `Files.writeString(a,b)` is a shorthand for `Files.writeString(a, b, StandardCharsets.UTF_8)`, while `getBytes()` with [no arguments](https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#getBytes--) will use the platform default character set. This could lead to different behaviour with the default character set is not ASCII or UTF-8.
> Thanks for the review, @gnu-andrew!
>
> > I think it should be `Files.writeString(a, b) => Files.write(a, b.getBytes(StandardCharsets.UTF_8))` rather than `Files.writeString(a, b) => Files.write(a, b.getBytes())`. `Files.writeString(a,b)` is a shorthand for `Files.writeString(a, b, StandardCharsets.UTF_8)`, while `getBytes()` with [no arguments](https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#getBytes--) will use the platform default character set. This could lead to different behaviour with the default character set is not ASCII or UTF-8.
>
> That makes sense to me. However, it makes more sense to do this cleanup as a separate bug. We have a lot of code using this pattern with the cgroups v2 backport. I've filed https://bugs.openjdk.org/browse/JDK-8301332 and will post for review shortly.
I agree a cleanup bug is the right way in this situation. I hadn't seen this pattern in earlier backports.
Thanks for the quick bug and PR for that. No issue for me with this one as is.
-------------
PR: https://git.openjdk.org/jdk8u-dev/pull/218
More information about the jdk8u-dev
mailing list