RFR: 8331195: Improve com.sun.net.httpserver.HttpExchange usability [v3]
robert engels
duke at openjdk.org
Wed May 1 13:28:54 UTC 2024
On Wed, 1 May 2024 13:06:02 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
> Maybe the lesser of the two evil would be to return `void`.
If you return void you prevent the linter from trapping the improper use of the OutputStream. If you use these methods - or even the existing similar structure - you must get and write to the OutputStream and close it - or the connection is borked.
This goes a long way to prevent that.
I don't understand the critique of the method names - they do exactly what they state - they set up the exchange for returning a response - the response should be sent using the OutputStream (although technically they could ignore the return value and use getResponseBody() - but why?) - and the OS should be closed.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/18955#issuecomment-2088454868
More information about the net-dev
mailing list