RFR: 8253005: Add `@throws IOException` in javadoc for `HttpEchange.sendResponseHeaders` [v7]

Daniel Fuchs dfuchs at openjdk.java.net
Thu Nov 5 17:58:58 UTC 2020


On Thu, 5 Nov 2020 17:35:09 GMT, Chris Hegarty <chegar at openjdk.org> wrote:

>> Patrick Concannon has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8252304: Added read to TestHandler to ensure requestBody consumed before closing exchange
>
> test/jdk/java/net/httpclient/SendResponseHeadersTest.java line 99:
> 
>> 97:                     // unexpected exception thrown, return error to client
>> 98:                     t.printStackTrace();
>> 99:                     os.write(("Unexpected error: " + t).getBytes());
> 
> Hmm... I'd be tempted to drop this catch block altogether, it's not possible to know exactly what to do there? given that we don't know what the failure is.

This is executed on the server side - the Throwable here is the AssertionError thrown by expectThrows if the expected exception is not thrown. It is important to return this to the client side so that the client side (main thread) can fail properly.

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

PR: https://git.openjdk.java.net/jdk/pull/1014


More information about the net-dev mailing list