RFR: 8276994: java/nio/channels/Channels/TransferTo.java leaves multi-GB files in /tmp [v3]
Daniel Fuchs
dfuchs at openjdk.java.net
Thu Nov 11 18:47:34 UTC 2021
On Thu, 11 Nov 2021 17:17:01 GMT, Pavel Rappo <prappo at openjdk.org> wrote:
>> Lance Andersen has updated the pull request incrementally with one additional commit since the last revision:
>>
>> tweak initialiation
>
> test/jdk/java/nio/channels/Channels/TransferTo.java line 165:
>
>> 163: System.out.printf("Cleaning up: %s, %s%n", sourceFile, targetFile);
>> 164: Files.deleteIfExists(sourceFile);
>> 165: Files.deleteIfExists(targetFile);
>
> What about an exception thrown from `Files.deleteIfExists(sourceFile)` in that `finally` block?
Right - maybe that should be done in a private method where the exception would be catch'ed and logged (`printStackTrace`) - otherwise an exception in the finally clause risks masking any exception that was thrown before the finally clause was reached.
-------------
PR: https://git.openjdk.java.net/jdk/pull/6360
More information about the nio-dev
mailing list