RFR: 8292044: HttpClient doesn't handle 102 or 103 properly [v9]

Daniel Fuchs dfuchs at openjdk.org
Wed Sep 14 14:58:58 UTC 2022


On Wed, 14 Sep 2022 13:59:13 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Close the connection/stream when a 101 response isn't expected
>
> src/java.net.http/share/classes/jdk/internal/net/http/Exchange.java line 571:
> 
>> 569:                     exchImpl.onProtocolError(errMsg);
>> 570:                 } catch (Throwable ignore){
>> 571:                     // ignored
> 
> I decided to intentionally ignore any exceptions here because I couldn't think of anything different that we could do here, would there?

I agree. But I believe you should create the exception outside of the try and pass it both to the exchangeImpl and the returned failed future. The concrete implementation of `onProtocolError` should end up calling `cancelImpl` on the concrete subclass in both cases. Calling `cancelImpl` should take care of proper exception recording and take care of operation ref counting too.

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

PR: https://git.openjdk.org/jdk/pull/10169


More information about the net-dev mailing list