RFR: 8367067: Improve exception handling in HttpRequest.BodyPublishers [v2]
Daniel Fuchs
dfuchs at openjdk.org
Tue Sep 9 13:30:56 UTC 2025
On Mon, 8 Sep 2025 18:06:23 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:
>> Can bufSize be <= 0 in our implementation? Where does bufSize comes from? If it can't be <= 0 in our implemlementation then an `assert` would be more appropriate.
>
> It is provided in the ctor above using `Utils.BUFSIZE`, which reads the `jdk.httpclient.bufsize` system property, and that can be negative.
I think it would make more sense to make sure that Utils.BUFSIZE is initialized to a strictly positive value and only assert here. It could be useful to see if we have any test that set BUFSIZE to a small value - but if we don't maybe we could go and clamp it to e.g. `2^10 <= BUFSIZE < 2^24` or `2^10 <= BUFSIZE <= 2^23` if we want to keep powers of two.
(2^24 - 1 is the maximum allowed value for [SETTINGS_MAX_FRAME_SIZE](https://www.rfc-editor.org/rfc/rfc9113.html#SETTINGS_MAX_FRAME_SIZE) )
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26876#discussion_r2333555522
More information about the net-dev
mailing list