On Tue, 30 Apr 2024 15:40:20 GMT, Daniel Fuchs <dfu...@openjdk.org> wrote:

>> robert engels has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Update 
>> src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java
>>   
>>   Co-authored-by: Michael McMahon 
>> <70538289+michael-mc-ma...@users.noreply.github.com>
>
> src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java 
> line 237:
> 
>> 235:      */
>> 236:     public final OutputStream sendResponseHeadersChunked(int code) 
>> throws IOException {
>> 237:         sendResponseHeaders(code,CHUNKED_CONTENT);
> 
> I don't like the fact that this methor returns an `OutputStream` when other 
> `sendResponseXxx` methods return `void`. IMO it should either be renamed or 
> the return type changed to `void`, or maybe it should simply be dropped.

The purpose was that if you state you are sending a chunked response, you must 
close the output stream. By returning it - the linter will catch that it is 
closed, or used in a try-with-resources.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/18955#discussion_r1585100616

Reply via email to