Question

Java's JPasswordField is encoding the input which user enter in password field and I don't want it. I am checking password against database values which are purely numeric values.

Am entering the numeric values for password as

12345 

and it returns

[C@1e9b48b
Was it helpful?

Solution

I think when you mean encoding, you're probably trying to use the toString method. Which on a char array, will just use the standard object toString method.

Instead you could probably do

String password = new String(passwordField.getPassword());

The only other way it's "encoded" is if you're getting an encrypted password somehow.

OTHER TIPS

The doc come with a sample http://docs.oracle.com/javase/tutorial/uiswing/components/passwordfield.html

The input is not 'encoded' but for each character you enter a special character is printed in the inout field.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top