RFR: 8358688: HttpClient: Simplify file streaming in RequestPublishers.FilePublisher [v5]
Jaikiran Pai
jpai at openjdk.org
Thu Jun 12 08:36:31 UTC 2025
On Wed, 11 Jun 2025 12:32:13 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:
>> Simplifies content streaming for `HttpRequest.BodyPublishers::ofFile(Path)`, which delegates to `RequestPublishers.FilePublisher::create(Path)`. This effectively replaces all usages of `FileInputStream::new` in `HttpClient` with `Files::newInputStream(Path)`. See the JBS ticket description for the full story.
>>
>> Also removing certain test files which were rendered redundant after `SecurityManager` removal. We do this in this PR, since tests were added due to touched lines.
>>
>> `tier1,2` results on b5f3c8dc6f4 are attached to the ticket.
>
> Volkan Yazici has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix `FilePublisherTest`
test/jdk/java/net/httpclient/FilePublisher/FilePublisherTest.java line 168:
> 166: try (FileSystem fs = newZipFs(zipPath)) {
> 167: Path fileInZip = zipFsFile(fs);
> 168: Files.deleteIfExists(fileInZip);
Now that I look at this, perhaps we should just change these 2 lines:
Path fileInZip = zipFsFile(fs);
Files.deleteIfExists(fileInZip);
to:
Path fileInZip = fs.getPath("non-existent.txt");
The call to `zipFsFile(...)` creates a ZIP entry within the ZIP and we then delete it immediately here with the deleteIfExists(...) call. At least for this new test, this creation followed by the deletion isn't necessary.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25662#discussion_r2142061997
More information about the net-dev
mailing list