RFR: 8358688: HttpClient: Simplify file streaming in RequestPublishers.FilePublisher [v3]
Volkan Yazici
vyazici at openjdk.org
Wed Jun 11 10:49:48 UTC 2025
On Wed, 11 Jun 2025 09:50:32 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> Volkan Yazici has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Update tests
>
> src/java.net.http/share/classes/jdk/internal/net/http/RequestPublishers.java line 268:
>
>> 266: } catch (NoSuchFileException nsfe) {
>> 267: // The old code was using `FileInputStream::new`, which throws `FNFE` if file doesn't exist.
>> 268: // Preserving that behaviour after migrating to `Files::newInputStream`:
>
> Nit - since the BodyPublishers.ofFile(...) specifies a `FileNotFoundException`, I think a better comment here and a few lines above might be: "// Throw FileNotFoundException to match the specification of BodyPublishers.ofFile()"
This indeed sounds better, and is also shorter. Implemented in 3fbb8cd63a8.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25662#discussion_r2139814236
More information about the net-dev
mailing list