RFR: 8355954: File.delete removes read-only files (win) [v3]
Johannes Döbler
duke at openjdk.org
Thu May 15 11:13:58 UTC 2025
On Thu, 15 May 2025 09:40:13 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8355954: Fix HashedPasswordFileTest failure due to obsolete read-only attribute being set
>
> test/jdk/java/io/File/DeleteReadOnly.java line 61:
>
>> 59: @Test
>> 60: @Order(1)
>> 61: @EnabledOnOs({OS.AIX, OS.LINUX, OS.MAC})
>
> Have you look at creating a simpler test that doesn't use Order. If you drop DIR and FILE then each test could create the file or directory as needed so there wouldn't be any dependency on order.
If each test method creates needed files and sub directories, then It could be useful to let JUnit create and inject a temporary root directory:
@org.junit.jupiter.api.io.TempDir
private static File testDir;
JUnit will automatically delete it with all content after the test methods have run. (But this can fail if readonly files are encountered).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24977#discussion_r2090925493
More information about the core-libs-dev
mailing list