RFR: 8345286: Remove use of SecurityManager API from misc areas [v2]
Jaikiran Pai
jpai at openjdk.org
Mon Dec 2 14:05:58 UTC 2024
On Mon, 2 Dec 2024 13:43:41 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:
>> Jaikiran Pai has updated the pull request incrementally with four additional commits since the last revision:
>>
>> - remove unnecessary space
>> - Path.of() instead of Paths.get()
>> - fix formatting of try-with-resources in CgroupSubsystemController.java
>> - leave out MethodUtil from the clean up
>
> src/java.base/linux/classes/jdk/internal/platform/CgroupSubsystemController.java line 70:
>
>> 68: String line = bufferedReader.readLine();
>> 69: return line;
>> 70: } catch (IOException e) {
>
> We can use `Files.lines` here right away:
>
> Suggestion:
>
> try (Stream<String> lines = Files.lines(filePath)) {
> Optional<String> firstLine = lines.findFirst();
> return firstLine.orElse(null);
> } catch (UncheckedIOException | IOException e) {
Is the catch for `UncheckedIOException` due to some previously known failure resulting in the use of these APIs?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22478#discussion_r1865907116
More information about the serviceability-dev
mailing list