On Fri, 19 Jul 2024 19:21:05 GMT, Chris Plummer <[email protected]> wrote:
>> Sonia Zaldana Calles has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> Ensuring test case deletes file in case of exception
>
> test/hotspot/jtreg/serviceability/dcmd/compiler/PerfMapTest.java line 124:
>
>> 122: output.shouldContain("Failed to create nonexistent/%s for perf
>> map".formatted(test_dir));
>> 123: output.shouldNotHaveExitValue(0);
>> 124: Files.deleteIfExists(path);
>
> If the file exists, that means the expected error message will not be found,
> which means an exception will be thrown before you get to the
> `Files.deleteIfExits(path)` call. If the file doesn't exist, then there is
> nothing to delete. So as things stand now this call will never delete
> anything. Maybe put it in a finally block so if the file does exist it will
> get deleted.
Makes sense, I added the finally block.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20257#discussion_r1684933809