RFR: 8320577: Improve MessageHeader's toString() function to make HttpURLConnection's debug log readable

Oliver Lockwood duke at openjdk.org
Wed Nov 22 15:24:06 UTC 2023


On Wed, 22 Nov 2023 11:57:46 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> At the moment, if you have debug logging turned on for the `HttpURLConnection` class, then from [line 746](https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java#L746) a log message like this is generated:
>>> sun.net.www.MessageHeader at 49c4f2906 pairs: {null: HTTP/1.1 200}{Content-Type: application/json}{Transfer-Encoding: chunked}{Date: Thu, 09 Nov 2023 11:50:00 GMT}{Keep-Alive: timeout=60}{Connection: keep-alive}
>> 
>> The lack of separation after the `Object.toString()` output makes it hard to realise from the above that it's trying to say "6 pairs". 
>> The change proposed by this PR would make the same log operation output this, instead:
>>> sun.net.www.MessageHeader at 49c4f290 6 pairs: {null: HTTP/1.1 200}{Content-Type: application/json}{Transfer-Encoding: chunked}{Date: Thu, 09 Nov 2023 11:50:00 GMT}{Keep-Alive: timeout=60}{Connection: keep-alive}
>
> Looks reasonable to me. Can you update the Copyright Years in the file? (change 2021 into 2023).

@dfuch @jaikiran can you please clarify?  The copyright year line currently has:
` * Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved.`

Do you want this changing to:

1. ` * Copyright (c) 1995, 2023, Oracle and/or its affiliates. All rights reserved.` or
2. ` * Copyright (c) 1995, 2021, 2023, Oracle and/or its affiliates. All rights reserved.` ?
 
Thanks for taking the time to review my contribution.

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

PR Comment: https://git.openjdk.org/jdk/pull/16615#issuecomment-1822975093


More information about the net-dev mailing list