Question

public void doRegister() throws SQLException{ 
    String password = "test";
    PasswordService dps = new DefaultPasswordService(); 
     String temp = dps.encryptPassword(password); 
     System.out.println("AAAA  "+dps.passwordsMatch(password, temp)); 

} 

this outputs AAAA false

What is the problem?

Was it helpful?

Solution

I solved the problem. My default locale is TR_tr. When i run the program without changing the default locale it outputs false.

But when i run the program as below (it sets the default locale to ENGLISH) it outputs true

public class App { 
    public static void main(String[] args) { 
        PasswordService psd = new DefaultPasswordService(); 
        String password = "333"; 
        String enc = psd.encryptPassword(password); 
        Locale.setDefault(Locale.ENGLISH); 
        System.out.println(Locale.getDefault()); 
        System.out.print(psd.passwordsMatch(password, enc)); 

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