Skip to content

Conversation

@turbanoff
Copy link
Member

@turbanoff turbanoff commented Feb 7, 2023

JDK-8297211 (#11258) missed one case with date headers: last-modified, date, expires. We can avoid expensive NPE.


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-8301964: Expensive fillInStackTrace operation in HttpURLConnection.getLastModified when no last-modified in response

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12451

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

Using diff file

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

…LastModified when no last-modified in response
@bridgekeeper
Copy link

bridgekeeper bot commented Feb 7, 2023

👋 Welcome back aturbanov! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Feb 7, 2023

@turbanoff 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 Feb 7, 2023
@turbanoff turbanoff changed the title [PATCH] Expensive fillInStackTrace operation in HttpURLConnection.getLastModified when no last-modified in response 8301964: Expensive fillInStackTrace operation in HttpURLConnection.getLastModified when no last-modified in response Feb 7, 2023
@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 7, 2023
@mlbridge
Copy link

mlbridge bot commented Feb 7, 2023

Webrevs

dateString = dateString + " GMT";
}
try {
return Date.parse(dateString);
Copy link
Contributor

Choose a reason for hiding this comment

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

Changing this method makes me wonder if we should replace the Date.parse usage with DateTimeFormatter while we are there, also the parameter name "Default" wants to be renamed too.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've renamed Default to defaultValue.
Regarding Date.parse replacement: I think it's a quite non-trivial task, which deserves a separate issue. As I see, there already was issue created and closed as Won't Fix - JDK-4097762

…tLastModified when no last-modified in response

rename Default to defaultValue
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 like a good cleanup. Thanks for renaming Default into defaultValue.

@openjdk
Copy link

openjdk bot commented Feb 7, 2023

@turbanoff 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:

8301964: Expensive fillInStackTrace operation in HttpURLConnection.getLastModified when no last-modified in response

Reviewed-by: dfuchs, jpai, alanb

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 166 new commits pushed to the master branch:

  • a917fb3: 7033677: potential cast error in MemberEnter
  • 6120319: 8302226: failure_handler native.core should wait for coredump to finish
  • fef3eab: 8302734: Parallel: Remove unused LGRPSpace::_invalid_region
  • ea5bfea: 8302661: Parallel: Remove PSVirtualSpace::is_aligned
  • edf238b: 8302635: Race condition in HttpBodySubscriberWrapper when cancelling request
  • cd77fcf: 8290822: C2: assert in PhaseIdealLoop::do_unroll() is subject to undefined behavior
  • 57c9bc3: 8302335: IGV: Bytecode not showing
  • 57fde75: 8302113: Improve CRC32 intrinsic with crypto pmull on AArch64
  • b8c9d6c: 8302158: PPC: test/jdk/jdk/internal/vm/Continuation/Fuzz.java: AssertionError: res: false shouldPin: false
  • dc55a7f: 8302202: Incorrect desugaring of null-allowed nested patterns
  • ... and 156 more: https://git.openjdk.org/jdk/compare/9dad874ff9f03f5891aa8b37e7826a67c851f06d...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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 7, 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.

Hello Andrey, the changes look fine to me. Please update the copyright years on URLConnection.java and HttpsURLConnectionImpl.java files before integrating.

…tLastModified when no last-modified in response

update copyright year
@turbanoff turbanoff requested a review from AlanBateman February 8, 2023 16:00
Copy link
Contributor

@AlanBateman AlanBateman left a comment

Choose a reason for hiding this comment

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

The changes looks okay, I just wonder why the try-catch around Date.parse catches Exception, should it be IllegalArgumentException?

@turbanoff
Copy link
Member Author

Javadoc of the Date.parse method does not mention which exceptions could be thrown. That's why I decided to be on the safe side and do not change exception type.

@AlanBateman
Copy link
Contributor

Javadoc of the Date.parse method does not mention which exceptions could be thrown. That's why I decided to be on the safe side and do not change exception type.

That's a bug in its javadoc. It may be deprecated but it should specify that it throws IAE if the input cannot be parsed.

@dfuch
Copy link
Member

dfuch commented Feb 13, 2023

Javadoc of the Date.parse method does not mention which exceptions could be thrown. That's why I decided to be on the safe side and do not change exception type.

That's a bug in its javadoc. It may be deprecated but it should specify that it throws IAE if the input cannot be parsed.

Yes - thank you. This is supposed to be a simple cleanup so I'm feeling more comfortable that the logic hasn't changed. The code before the change was also catching Exception.

@AlanBateman
Copy link
Contributor

Yes - thank you. This is supposed to be a simple cleanup so I'm feeling more comfortable that the logic hasn't changed. The code before the change was also catching Exception.

We can create a bug to replace the catch Exception with catch IllegalArgumentException, better still be to replace this usage (surprised it wasn't replaced a long time ago).

@turbanoff
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Feb 25, 2023

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

  • 1dbd18a: 8302120: Prefer ArrayList to LinkedList in AggregatePainter
  • 2e78d83: 8302899: Executors.newSingleThreadExecutor can use Cleaner to shutdown executor
  • 17e3769: 8302871: Speed up StringLatin1.regionMatchesCI
  • b4ea807: 8288912: vmTestbase/nsk/stress/strace/strace002.java fails with Unexpected method name: currentCarrierThread
  • ccf3340: 8303083: (bf) Remove private DirectByteBuffer(long, int) constructor before JDK 21 GA
  • 83d77b1: 8303072: Memory leak in exeNullCallerTest.cpp
  • 7d8b8ba: 8303131: pandoc.exe mangles all processed html files
  • 8f7c496: 8302810: NMT gtests don't correctly check for marked ranges
  • 1a07871: 8302173: Button border overlaps with button icon on macOS system LaF
  • 796cdd5: 8302677: JFR: Cache label and contentType in EventType and ValueDescriptor
  • ... and 267 more: https://git.openjdk.org/jdk/compare/9dad874ff9f03f5891aa8b37e7826a67c851f06d...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Feb 25, 2023

@turbanoff Pushed as commit 3a9f491.

💡 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

Development

Successfully merging this pull request may close these issues.

4 participants