RFR: 8274112: (fc) Tune FileChannel.transferTo() [v6]
Brian Burkhalter
bpb at openjdk.java.net
Fri Apr 29 23:12:46 UTC 2022
On Fri, 29 Apr 2022 15:18:22 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8274112: Revert all changes except mapped transfer threshold
>
> test/jdk/java/nio/channels/FileChannel/TransferToChannel.java line 157:
>
>> 155: private static void transferFileDirectly() throws Exception {
>> 156: outFile.delete();
>> 157: FileOutputStream fos = new FileOutputStream(outFile);
>
> Can try-with-resources be used here for both fos and out?
Yes. Fixed by commit c72b4b58f57d998423fb94b17ac950185109b933.
> test/jdk/java/nio/channels/FileChannel/TransferToChannel.java line 169:
>
>> 167: pos += bytesTransferred;
>> 168: else
>> 169: throw new Exception("transfer failed");
>
> Including some position information in the exception would help diagnose, especially with intermittent failures, if they happen.
Fixed by commit c72b4b58f57d998423fb94b17ac950185109b933.
> I would probably have been tempted to convert this test to leverage TestNG as I think it would streamline the test a bit (or safe this for a future date)
I prefer to leave the TestNG conversion to another issue TBD.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5623
More information about the nio-dev
mailing list