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));
}
这输出AAAA false
问题是什么?
我解决了问题。我的默认语言环境是TR_tr
。当我在不更改默认语言环境的情况下运行该程序时,将输出false
。
但是当我如下运行程序时(它将默认语言环境设置为英语),它会输出 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));
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句