On Mon, 30 Mar 2026 08:56:50 GMT, Volkan Yazici <[email protected]> wrote:

>> Jaikiran Pai has updated the pull request incrementally with two additional 
>> commits since the last revision:
>> 
>>  - add additional bad status lines
>>  - Daniel's review - minor cleanup to the test
>
> src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java 
> line 2040:
> 
>> 2038:     // parsed.
>> 2039:     private static int parseConnectResponseCode(final String 
>> statusLine) {
>> 2040:         final int invalidStatusLine = 0;
> 
> *Nit:* We generally use `-1` to indicate a failure while reading the status 
> line. You can search for usages of `-1` in this file, in particular, see 
> lines 1076 and 1415.

Hello Volkan, I had considered `-1`, but the call site where this method's 
return value is used is already equipped with dealing with `0` for response 
code to mean that it's invalid. I can still return -1 here but that would then 
require additional changes to the call site to treat -1 the same as 0. Given 
that the call site is already a bit involved, I decided to use 0 and keep it 
simple. Let me know if you would like me to change that.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30466#discussion_r3008970352

Reply via email to