AuthenticationPanel.getPassword return char[]
authorKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Sun, 23 Jan 2011 13:30:19 +0000 (16:30 +0300)
committerKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Wed, 20 Apr 2011 12:01:31 +0000 (16:01 +0400)
To let the client fill the returned array with zeros, as per JTextField.getPassword() javadoc.

platform/platform-api/src/com/intellij/util/net/AuthenticationDialog.java
platform/platform-api/src/com/intellij/util/net/AuthenticationPanel.java
plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgUsernamePasswordDialog.java

index b6ae7fbd2ee7329825311b9b8e8e057846d7a1d0..2baff8758f00469efc0b0af3393336b82253c298 100644 (file)
@@ -64,7 +64,7 @@ public class AuthenticationDialog extends DialogWrapper {
         new AbstractAction (CommonBundle.getOkButtonText()) {
           public void actionPerformed(ActionEvent e) {
             HttpConfigurable.getInstance().PROXY_LOGIN = panel.getLogin();
-            HttpConfigurable.getInstance().setPlainProxyPassword(panel.getPassword());
+            HttpConfigurable.getInstance().setPlainProxyPassword(String.valueOf(panel.getPassword()));
             HttpConfigurable.getInstance().PROXY_AUTHENTICATION = true;
             HttpConfigurable.getInstance().KEEP_PROXY_PASSWORD = panel.isRememberPassword();
 
index b6b94a4d5df98b65fde3c21176fccd98af69906d..efa183c96145d539debbfd548b85e99a4462571a 100644 (file)
@@ -51,8 +51,8 @@ public class AuthenticationPanel extends JPanel {
     return myLoginTextField.getText();
   }
 
-  public String getPassword () {
-    return new String (myPasswordTextField.getPassword());
+  public char[] getPassword () {
+    return myPasswordTextField.getPassword();
   }
 
   public boolean isRememberPassword () {
index 9ba12fd9271531786eebafc74568e88cae1ef3cf..f80249d7ff9c72a152909e6029948db52526f761 100644 (file)
@@ -45,7 +45,7 @@ public class HgUsernamePasswordDialog extends DialogWrapper {
   }
 
   public String getPassword() {
-    return authPanel.getPassword();
+    return String.valueOf(authPanel.getPassword());
   }
 
   public boolean isRememberPassword() {