Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Conversation

oliverlockwood
Copy link
Contributor

@oliverlockwood oliverlockwood commented Nov 10, 2023

At the moment, if you have debug logging turned on for the HttpURLConnection class, then from line 746 a log message like this is generated:

sun.net.www.MessageHeader@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@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}


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8320577: Improve MessageHeader's toString() function to make HttpURLConnection's debug log readable (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/16615/head:pull/16615
$ git checkout pull/16615

Update a local copy of the PR:
$ git checkout pull/16615
$ git pull https://git.openjdk.org/jdk.git pull/16615/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 16615

View PR using the GUI difftool:
$ git pr show -t 16615

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/16615.diff

Webrev

Link to Webrev Comment

@bridgekeeper bridgekeeper bot added the oca Needs verification of OCA signatory status label Nov 10, 2023
@bridgekeeper
Copy link

bridgekeeper bot commented Nov 10, 2023

Hi @oliverlockwood, welcome to this OpenJDK project and thanks for contributing!

We do not recognize you as Contributor and need to ensure you have signed the Oracle Contributor Agreement (OCA). If you have not signed the OCA, please follow the instructions. Please fill in your GitHub username in the "Username" field of the application. Once you have signed the OCA, please let us know by writing /signed in a comment in this pull request.

If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please use "Add GitHub user oliverlockwood" as summary for the issue.

If you are contributing this work on behalf of your employer and your employer has signed the OCA, please let us know by writing /covered in a comment in this pull request.

@openjdk
Copy link

openjdk bot commented Nov 10, 2023

@oliverlockwood The following label will be automatically applied to this pull request:

  • net

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the net net-dev@openjdk.org label Nov 10, 2023
@oliverlockwood oliverlockwood force-pushed the improve-MessageHeader-toString-to-make-HttpURLConenection-debug-log-readable branch from 08703e0 to 5cb93c0 Compare November 10, 2023 14:29
@openjdk
Copy link

openjdk bot commented Nov 10, 2023

@oliverlockwood Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. See OpenJDK Developers’ Guide for more information.

@bridgekeeper bridgekeeper bot removed the oca Needs verification of OCA signatory status label Nov 20, 2023
@djelinski
Copy link
Member

Hi @oliverlockwood all PRs need to be associated to a Java Bug System ticket; I created one for you. Please change the PR title to 8320577 to mark this PR as ready for review.

@oliverlockwood oliverlockwood changed the title Improve MessageHeader's toString() function to make HttpURLConnection's debug log readable 8320577: Improve MessageHeader's toString() function to make HttpURLConnection's debug log readable Nov 22, 2023
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 22, 2023
@oliverlockwood
Copy link
Contributor Author

Hi @djelinski, thank you for taking the time to do this on my behalf. I have now formed the title to be like issue number: message as per the check and other open PRs that I can see. Please let me know if you need me to jump through any other hurdles 😄

@mlbridge
Copy link

mlbridge bot commented Nov 22, 2023

Webrevs

Copy link
Member

@dfuch dfuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me. Can you update the Copyright Years in the file? (change 2021 into 2023).

Copy link
Member

@jaikiran jaikiran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I've seen that log message in the log files a few times before and it never occurred to me that it was trying to say that there are "X" number of message header pairs.
Change looks good to me other than what Daniel already noted about the copyright year.

@openjdk
Copy link

openjdk bot commented Nov 22, 2023

@oliverlockwood This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

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

Reviewed-by: dfuchs, jpai

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 153 new commits pushed to the master branch:

  • 572b14a: 8320536: problemlist failing serviceability/attach/ConcAttachTest.java test on macosx
  • 30462f9: 8318986: Improve GenericWaitBarrier performance
  • 407cdd4: 8320207: doclet incorrectly chooses code font for a See Also link
  • 1629a90: 8320331: G1 Full GC Heap verification relies on metadata not reset before verification
  • 93bdc2a: 8306055: Add a built-in Catalog to JDK XML module
  • a4bd9e4: 8319440: RISC-V: jdk can't be built with clang due to register keyword
  • 524da14: 8320418: PPC64: invokevfinal_helper duplicates code to handle ResolvedMethodEntry
  • 5d4a54b: 8319449: compiler/print/CompileCommandPrintMemStat.java fails on Graal
  • 35526d0: 8257076: os::scan_pages is empty on all platforms
  • 25cebe8: 8317799: AIX PPC64: FFI symbol lookup doesn't find symbols
  • ... and 143 more: https://git.openjdk.org/jdk/compare/6b21ff61dad6f633c744c1c33c29ea86183b509d...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@dfuch, @jaikiran) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 22, 2023
@oliverlockwood
Copy link
Contributor Author

oliverlockwood commented Nov 22, 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.

@dfuch
Copy link
Member

dfuch commented Nov 22, 2023

    • Copyright (c) 1995, 2023, Oracle and/or its affiliates. All rights reserved.
  1. is the correct alternative. Thanks!

@oliverlockwood
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Nov 22, 2023
@openjdk
Copy link

openjdk bot commented Nov 22, 2023

@oliverlockwood
Your change (at version 029cd9a) is now ready to be sponsored by a Committer.

Copy link
Member

@dfuch dfuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! If you need a sponsor, please drop a message here after integrating.

@dfuch
Copy link
Member

dfuch commented Nov 22, 2023

/sponsor

@openjdk
Copy link

openjdk bot commented Nov 22, 2023

Going to push as commit aac4318.
Since your change was applied there have been 153 commits pushed to the master branch:

  • 572b14a: 8320536: problemlist failing serviceability/attach/ConcAttachTest.java test on macosx
  • 30462f9: 8318986: Improve GenericWaitBarrier performance
  • 407cdd4: 8320207: doclet incorrectly chooses code font for a See Also link
  • 1629a90: 8320331: G1 Full GC Heap verification relies on metadata not reset before verification
  • 93bdc2a: 8306055: Add a built-in Catalog to JDK XML module
  • a4bd9e4: 8319440: RISC-V: jdk can't be built with clang due to register keyword
  • 524da14: 8320418: PPC64: invokevfinal_helper duplicates code to handle ResolvedMethodEntry
  • 5d4a54b: 8319449: compiler/print/CompileCommandPrintMemStat.java fails on Graal
  • 35526d0: 8257076: os::scan_pages is empty on all platforms
  • 25cebe8: 8317799: AIX PPC64: FFI symbol lookup doesn't find symbols
  • ... and 143 more: https://git.openjdk.org/jdk/compare/6b21ff61dad6f633c744c1c33c29ea86183b509d...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Nov 22, 2023
@openjdk openjdk bot closed this Nov 22, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Nov 22, 2023
@openjdk openjdk bot removed the sponsor Pull request is ready to be sponsored label Nov 22, 2023
@openjdk
Copy link

openjdk bot commented Nov 22, 2023

@dfuch @oliverlockwood Pushed as commit aac4318.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated net net-dev@openjdk.org
4 participants