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

8341366: Suspicious check in Locale.getDisplayName(Locale inLocale) #21298

Conversation

justin-curtis-lu
Copy link
Member

@justin-curtis-lu justin-curtis-lu commented Oct 1, 2024

Please review this PR which modifies a suspicious check in the fallback of Locale.getDisplayName(Locale inLocale).

As a fallback, a hard coded pattern is used. The previous code outputted the qualifiers if the displayNames array had length greater than 2. Just a few lines above, the array is initialized with a length of 3 and so the check is pointless.

It would be better, if replaced with a null check for the last element of the displayNames array, as that element may be null if there are no qualifiers. See L2317 ,

qualifierNames.length != 0 ? formatList(qualifierNames, listCompositionPattern) : null

For example, now a fallback (with no qualifiers) might look like: German instead of German (null).
But will remain the same (with qualifiers): German (Germany).


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-8341366: Suspicious check in Locale.getDisplayName(Locale inLocale) (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 21298

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 1, 2024

👋 Welcome back jlu! 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 Oct 1, 2024

@justin-curtis-lu 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:

8341366: Suspicious check in Locale.getDisplayName(Locale inLocale)

Reviewed-by: naoto

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

  • 62acc9c: 8341548: More concise use of classfile API
  • 7312eea: 8341131: Some jdk/jfr/event/compiler tests shouldn't be executed with Xcomp
  • 966eb72: 8341447: Open source closed frame tests # 5
  • b9db74a: 8341378: Open source few TrayIcon tests - Set8
  • 6546353: 8340203: Link color is hard to distinguish from text color in API documentation
  • 580eb62: 8320500: [vectorapi] RISC-V: Optimize vector math operations with SLEEF
  • 4a12f5b: 8341643: G1: Merged cards counter skewed by merge cards cache
  • 6e48618: 8341644: Compile error in cgroup coding when using toolchain clang
  • 7a1e832: 8336843: Deprecate java.util.zip.ZipError for removal
  • f62dba3: 8341597: ZipFileInflaterInputStream input buffer size uses uncompressed size
  • ... and 101 more: https://git.openjdk.org/jdk/compare/03149735e59b7d1d409a6e29ee05ae0537e03d53...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
Copy link

openjdk bot commented Oct 1, 2024

@justin-curtis-lu The following labels will be automatically applied to this pull request:

  • core-libs
  • i18n

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

@justin-curtis-lu justin-curtis-lu changed the title Suspicious check in Locale.getDisplayName(Locale inLocale) 8341366: Suspicious check in Locale.getDisplayName(Locale inLocale) Oct 1, 2024
@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 1, 2024
@mlbridge
Copy link

mlbridge bot commented Oct 1, 2024

Webrevs

Copy link
Member

@naotoj naotoj left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 2329 to 2331
result.append(" (");
result.append((String)displayNames[2]);
result.append((String) displayNames[2]);
result.append(')');
Copy link
Member

Choose a reason for hiding this comment

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

These appends can be chained, but probably it's my preference.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 8, 2024
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Oct 8, 2024
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 8, 2024
@justin-curtis-lu
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Oct 9, 2024

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

  • 52eded4: 8341170: Open source several Choice related tests (part 2)
  • a45abf1: 8341860: ProblemList applications/ctw/modules/java_base_2.java on linux-x64
  • 593c27e: 8341535: sun/awt/font/TestDevTransform.java fails with RuntimeException: Different rendering
  • 3180aaa: 8341832: Incorrect continuation address of synthetic SIGSEGV for APX in product builds
  • 3ab519f: 8341424: GHA: Collect hs_errs from build time failures
  • a24525b: 8339320: Optimize ClassFile Utf8EntryImpl#inflate
  • fcc9c8d: 8341854: Incorrect clearing of ZF in fast_unlock_lightweight on x86
  • 38c1d65: 8337980: Javac allows invocation of an inherited instance method from a static method
  • 950e3a7: 8341625: Improve ZipFile validation of the END header
  • e704c05: 8340547: Starting many threads can delay safepoints
  • ... and 123 more: https://git.openjdk.org/jdk/compare/03149735e59b7d1d409a6e29ee05ae0537e03d53...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Oct 9, 2024

@justin-curtis-lu Pushed as commit 49c7148.

💡 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
Development

Successfully merging this pull request may close these issues.

2 participants