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

6852577: Only for Nimbus LAF UIManager.get("PasswordField.echoChar") is null #10035

Closed
wants to merge 7 commits into from

Conversation

prsadhuk
Copy link
Contributor

@prsadhuk prsadhuk commented Aug 26, 2022

Default echo character obtained through PasswordField.echoChar UIProperty returns null for Nimbus L&F,
which is fixed by adding the default character * in the UIDefault table.


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-6852577: Only for Nimbus LAF UIManager.get("PasswordField.echoChar") is null

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10035

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 26, 2022

👋 Welcome back psadhukhan! 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 Aug 26, 2022

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

  • client

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 client client-libs-dev@openjdk.org label Aug 26, 2022
@prsadhuk prsadhuk changed the title 6852577: Only for Nimbus LAF UIManager.get(PasswordField.echoChar) is null 6852577: Only for Nimbus LAF UIManager.get("PasswordField.echoChar") is null Aug 26, 2022
@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 26, 2022
@mlbridge
Copy link

mlbridge bot commented Aug 26, 2022

Webrevs

@mrserb
Copy link
Member

mrserb commented Sep 6, 2022

I guess currently the Nimbus L&F use some char for the password field, how that place will intrract with this new ui property?

@prsadhuk
Copy link
Contributor Author

prsadhuk commented Sep 7, 2022

I guess currently the Nimbus L&F use some char for the password field, how that place will intrract with this new ui property?

Added code to interact with the property same way other L&F does. tested with

public class PasswordFieldTest {
        public static void main(String[] args) {
                UIManager.put("PasswordField.echoChar", '@');
                JFrame mainFrame = new JFrame("");
                JPasswordField passwordField = new javax.swing.JPasswordField();
                passwordField.setEnabled(true);
                passwordField.setText("blahblahblah");
                mainFrame.getContentPane().add(passwordField);
                mainFrame.setSize(300,100);
                mainFrame.setVisible(true);
        }
}

for (UIManager.LookAndFeelInfo laf :
UIManager.getInstalledLookAndFeels()) {
System.out.println("Testing L&F: " + laf.getClassName());
SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf));
Copy link
Member

Choose a reason for hiding this comment

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

You should probably call setLookAndFeel on the main thread, or you should call UIManager.get below on the EDT as well.

Copy link
Member

Choose a reason for hiding this comment

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

You should probably call setLookAndFeel on the main thread, or you should call UIManager.get below on the EDT as well.

In fact, I was inclined to use the main thread, it produces a shorter stack trace. EDT is okay, no change is required if you don't feel like it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Normally, many tests does this only which is what I did initially..

public static void main(String[] args) throws Exception {
    for (UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
            System.out.println("Testing l&f : " + laf.getClassName());
            SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf));

but I guess the present one will suffice too...

Copy link
Member

Choose a reason for hiding this comment

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

My initial concern was that you use two different threads where you shouldn't. I would rather use the main thread for all operations in this particular case. As long as setting the LaF and reading the properties are on the same thread, we're safe.

test/jdk/javax/swing/plaf/nimbus/PasswordFieldTest.java Outdated Show resolved Hide resolved
Comment on lines +53 to +59
System.out.println("Echo char: " +
UIManager.get("PasswordField.echoChar"));
if (UIManager.get("PasswordField.echoChar") == null) {
throw new RuntimeException(
"PasswordField.echoChar returns null for " +
laf.getClassName());
}
Copy link
Member

Choose a reason for hiding this comment

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

A question of style: do we usually wrap lines before the operator or after? Java Coding Style is for the former. This versions seems to have been updated and the code formatting is lost now; this draft is still for the same usage.

@openjdk
Copy link

openjdk bot commented Sep 28, 2022

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

6852577: Only for Nimbus LAF UIManager.get("PasswordField.echoChar") is null

Reviewed-by: tr, aivanov

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

  • c42ef70: 7148092: [macosx] When Alt+down arrow key is pressed, the combobox popup does not appear.
  • 94e14da: 8294057: Parallel: Tighten ParallelCompactData::initialize_region_data
  • 1ea0d6b: 8292301: [REDO v2] C2 crash when allocating array of size too large
  • c13e0ef: 8292848: AWT_Mixing and TrayIcon tests fail on el8 with hard-coded isOel7
  • 79ccc79: 8293613: need to properly handle and hide tmp VTMS transitions
  • 5e1e449: 8290920: sspi_bridge.dll not built if BUILD_CRYPTO is false
  • d827fd8: 8294430: RISC-V: Small refactoring for movptr_with_offset
  • 9d76ac8: 8292158: AES-CTR cipher state corruption with AVX-512
  • e5b65c4: 8290482: Update JNI Specification of DestroyJavaVM for better alignment with JLS, JVMS, and Java SE API Specifications
  • f8d9fa8: 8294483: Remove vmTestbase/nsk/jvmti/GetThreadState tests.
  • ... and 521 more: https://git.openjdk.org/jdk/compare/77cd917a97b184871ab2d3325ceb6c53afeca28b...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 Sep 28, 2022
@prsadhuk
Copy link
Contributor Author

prsadhuk commented Oct 7, 2022

/integrate

@openjdk
Copy link

openjdk bot commented Oct 7, 2022

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

  • d4c9a88: 6560981: (cal) unused local variables in GregorianCalendar, etc.
  • 5dd851d: 8281453: New optimization: convert ~x into -1-x when ~x is used in an arithmetic expression
  • 85569e9: 8286037: Bump minimum boot jdk to JDK 19
  • fef345b: 8293672: Update freetype md file
  • 5c030cc: 8290973: In AffineTransform, equals(Object) is inconsistent with hashCode()
  • f888aa9: 8293061: Combine CDSOptions and AppCDSOptions test utility classes
  • 73f0646: 8294839: Disable StressLongCountedLoop in compiler/loopopts/TestRemoveEmptyLoop.java
  • 2ceebf6: 8294456: Fix misleading-indentation warnings in core JDK libraries
  • ad7b7d4: 8294697: java/lang/Thread/virtual/ThreadAPI.testGetStackTrace2 failed with non-empty stack trace
  • e38ae8a: 8294759: Print actual lock/monitor ranking
  • ... and 636 more: https://git.openjdk.org/jdk/compare/77cd917a97b184871ab2d3325ceb6c53afeca28b...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Oct 7, 2022

@prsadhuk Pushed as commit 37bd4fb.

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

@prsadhuk prsadhuk deleted the JDK-6852577 branch October 7, 2022 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client client-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

5 participants