is JPasswordField.getPassword() encrypted

I've done some digging on the JPasswordField component and I can't seem to tell if the method getPassword() returns an encrypeted char [].

The reason I ask this is because i have coded a form asking for information to login to a mySQL database. I have basic textFields for the URL, database, port, and username info and then a JPasswordField for the password.

I was having problems with a authentication Exception being thrown by the JDBC driver. I then decided to output those strings in a System.out.println() so I could see what the password field was returning and its output show something like "s\@3ld6bu". I realized it was probably encrypting the entry but after reading the javaDoc and doing a forum search no one seems to say the getPassword() method encrypts the input.

basically my code is broken when i use the getPassword() method so instead I have to use getText() which works fine.

can someone clarify this for me.

[963 byte] By [jrallena] at [2007-10-2 18:27:00]
# 1

Its not encrypted.

The toString() method of an array does not display the contents of the array. It displays a memory address or hashvalue or something like that. Read the API for the Object class to see what the implementation of the default toString() method is.

You can iterate through the array and display the individual characters.

camickra at 2007-7-13 19:48:09 > top of Java-index,Desktop,Core GUI APIs...
# 2
> > You can iterate through the array and display the> individual characters.Or you can use Arrays.toString(array) to create a String representation.
sabre150a at 2007-7-13 19:48:09 > top of Java-index,Desktop,Core GUI APIs...
# 3
> Or you can use Arrays.toString(array) to create a String representation. One of these days I'll remember that class and method.
camickra at 2007-7-13 19:48:09 > top of Java-index,Desktop,Core GUI APIs...