-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8297211: Expensive fillInStackTrace operation in HttpURLConnection.getOutputStream0 when no content-length in response #11258
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
Conversation
…tOutputStream0 when no content-lenght in response
|
👋 Welcome back jpai! A progress list of the required criteria for merging this PR into |
Webrevs
|
simonis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your fix looks good, but there are two other places in the file with the same pattern in getHeaderFieldDate() and getHeaderFieldLong(). Can you please fix them as well?
|
Hello Volker, I have updated to PR to include those 3 places as well (there was one more in addition to the couple you noted). |
eastig
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
| if (value != null) { | ||
| try { | ||
| return Date.parse(value); | ||
| } catch (NumberFormatException e) { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(not a reviewer) I think NumberFormatException isn't sufficient here. Date.parse might throw an IllegalArgumentException.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SirYwell Thanks for spotting this. You are right: Date.parse
Attempts to interpret the string s as a representation of a date and time.
If the attempt is successful...
If the attempt fails, an IllegalArgumentException is thrown.
@jaikiran I suggest to use the original code for catching exceptions: } catch (Exception e) { }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right @SirYwell. It was a copy/paste error on my part. Thank you for catching it. I have updated the PR to fix that part and catch Exception like previously.
| if (value != null) { | ||
| try { | ||
| return Date.parse(value); | ||
| } catch (NumberFormatException e) { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SirYwell Thanks for spotting this. You are right: Date.parse
Attempts to interpret the string s as a representation of a date and time.
If the attempt is successful...
If the attempt fails, an IllegalArgumentException is thrown.
@jaikiran I suggest to use the original code for catching exceptions: } catch (Exception e) { }
simonis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now. Thanks for finding the additional occurrence.
One final comment: could you please leave the empty catch blocks in one line, i.e.
} catch (NumberFormatException e) { }
instead of:
} catch (NumberFormatException e) {
}
This format is also recommended in the Java Style Guidelines for empty blocks.
Done. Updated the PR with this suggested format. Testing in progress to make sure there are no regressions from these changes. |
dfuch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good to me. Approving provided that tier2 passes.
|
@jaikiran 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: 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 16 new commits pushed to the
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 |
simonis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
|
The tests came back fine without any related failures. Thank you everyone for the reviews and suggestions. |
|
/integrate |
|
Going to push as commit 392ac70.
Your commit was automatically rebased without conflicts. |
Can I please get a review for this small change which addresses https://bugs.openjdk.org/browse/JDK-8297211?
The change checks if the
content-lengthheader value is present before parsing it into aLongvalue. The commit also now catches the more specificNumberFormatExceptioninstead of a generalException. Given the context of the code, I believe this change in the exception type in the catch block should be fine.No new test has been introduced given the nature of this change. I have triggered existing tests to verify no unexpected regressions show up.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11258/head:pull/11258$ git checkout pull/11258Update a local copy of the PR:
$ git checkout pull/11258$ git pull https://git.openjdk.org/jdk pull/11258/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 11258View PR using the GUI difftool:
$ git pr show -t 11258Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11258.diff