On Mon, 4 Sep 2023 16:49:39 GMT, Daniel Fuchs <[email protected]> wrote:

> IIRC the `ProtocolException` here is caught higher in the stack - I believe 
> that's what the comment `// responseCode will be returned to caller` means. 
> @DarraghClarke might remember. There is much history here. The fix may appear 
> simple on the surface but I would like to double check that it doesn't break 
> anything.

'ProtocolException' is caught in 'getOutputStream0()' and re-throws as follows.

            // Save the response code which may have been set while enforcing
            // the 100-continue. disconnectInternal() forces it to -1
            int i = responseCode;
            disconnectInternal();
            responseCode = i;
            throw e;

As per specification server can return non 100 response code so 
'HttpURLConnection' have to handle  non 100 response code as per specification.

Note: Other clients does not throws exception if server decides to return non 
100 response code.

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

PR Comment: https://git.openjdk.org/jdk/pull/15483#issuecomment-1705996411

Reply via email to