According to documentation, getEncoded()
returns
an external encoded form for the key used when a standard representation of the key is needed outside the Java Virtual Machine, as when transmitting the key to some other party
Since you use password-based encryption, external form of the password is the password itself, therefore this behavour is correct.