Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8160970

No support for char[] while setting password in JPasswordField

XMLWordPrintable

      For security concerns, it is not recommended to use String for passwords. For the same reason JPasswordField.getPassword() returns char[]. However in scenarios where we will invoke the connection dialog of any connection type, we will pre-populate the username and password in the dialog for user to edit. In this use-case, for setting the password in JPasswordField we do not have a constructor or setter API that will accept the password as char[]. Because of this we are forced to create a String object containing the password and set it to JPasswordField which is a wrong practice. So we should get a constructor or setter API in JPasswordField that accepts char[].

            aivanov Alexey Ivanov
            shadowbug Shadow Bug
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: