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

8318646: Integer#parseInt("") throws empty NumberFormatException message #16320

Closed
wants to merge 5 commits into from

Conversation

rgiulietti
Copy link
Contributor

@rgiulietti rgiulietti commented Oct 23, 2023

Please review this simple fix to restore the original exception message that existed before 16050.


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-8318646: Integer#parseInt("") throws empty NumberFormatException message (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 16320

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 23, 2023

👋 Welcome back rgiulietti! 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 openjdk bot added the rfr Pull request is ready for review label Oct 23, 2023
@openjdk
Copy link

openjdk bot commented Oct 23, 2023

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

  • core-libs

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 core-libs core-libs-dev@openjdk.org label Oct 23, 2023
@mlbridge
Copy link

mlbridge bot commented Oct 23, 2023

Webrevs

@openjdk
Copy link

openjdk bot commented Oct 23, 2023

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

8318646: Integer#parseInt("") throws empty NumberFormatException message

Reviewed-by: redestad, alanb, bpb, darcy, uschindler

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

  • 1b15011: 8318476: Add resource consumption note to BigInteger and BigDecimal
  • 5ba9705: 8318485: Narrow klass shift should be zero if encoding range extends to 0x1_0000_0000

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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 Oct 23, 2023
Copy link
Member

@bplb bplb left a comment

Choose a reason for hiding this comment

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

+1

@rgiulietti
Copy link
Contributor Author

@uschindler You may want to make the Lucene tests more robust by making them immune to exception messages contents.

But thanks for trying out the EA releases on important libraries like Lucene ;-) It is important to have early feedback to gain more information before shipping the GA release.

@rgiulietti
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Oct 24, 2023

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

  • 3f446c5: 8318528: Rename TestUnstructuredLocking test
  • 0baa9ec: 8318474: Fix memory reporter for thread_count
  • 4a16d11: 8318455: Fix the compiler/sharedstubs/SharedTrampolineTest.java and SharedStubToInterpTest.java
  • a644670: 8318609: Upcall stubs should be smaller
  • e6f23a9: 8315024: Vector API FP reduction tests should not test for exact equality
  • fd332da: 8317289: javadoc fails with -sourcepath if module-info.java contains import statements
  • 6d3cb45: 8318591: avoid leaks in loadlib_aix.cpp reload_table()
  • cb383c0: 8318587: refresh libraries cache on AIX in print_vm_info
  • 4bfe226: 8310031: Parallel: Implement better work distribution for large object arrays in old gen
  • 08f7914: 8305753: Allow JIT compilation for -Xshare:dump
  • ... and 4 more: https://git.openjdk.org/jdk/compare/8d9a4b43f4fff30fd217dab2c224e641cb913c18...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Oct 24, 2023

@rgiulietti Pushed as commit 9bfa082.

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

@uschindler
Copy link
Member

uschindler commented Oct 24, 2023

@uschindler You may want to make the Lucene tests more robust by making them immune to exception messages contents.

But thanks for trying out the EA releases on important libraries like Lucene ;-) It is important to have early feedback to gain more information before shipping the GA release.

Thanks for this. Actually this was a bad example. This was just test code, so I will more or less only remove the message check. In that case it would be enough to check for the NumberFormatException. I will provide a fix for this.

This is a very old test from a not so well-maintained module. Anyways it helped a bit to make the code more clean, because the NumberFormatException is now generated in the same way everywhere which makes it more consistent.

I mainly openend the iusse to inform you about that incompatibility because the exception message looks the same since very early java versions. So suddenly chaging it might bring others into the same situation like we were. I agree the spec does not enforce a message, but a more helpful message is always better than the completely empty one. So I would say, this PR is just a cleanup so "enhancement" as said by Alan Bateman is a good categorization.

Thanks for the quick fix. But I will fix the issue in Lucene, too!

P.S.: At other code we do not rely on exception messages. In recent code of MemorySegment we have some ambiguity with IllegalStateException when the scope of a memory segment was closed. I refused to look into the exception message and instead of parsing mesage - when catching exception, it now checks the memorysegment's scope was closed and only then convert the exception to a Lucene "AlreadyClosedException". In all other cases it is rethrowing the original exception. With exception messages you would have to look for some text string in them which is fragile. See this example: apache/lucene#12707

@rgiulietti rgiulietti deleted the 8318646 branch October 30, 2023 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

6 participants