【发布时间】:2021-07-22 04:56:52
【问题描述】:
我正在检查字符串是否未加密,然后显示消息,但其抛出 HTTP Status 500 – Internal Server Error 如下:
org.jasypt.exceptions.EncryptionOperationNotPossibleException
org.jasypt.encryption.pbe.StandardPBEByteEncryptor.decrypt(StandardPBEByteEncryptor.java:1055)
org.jasypt.encryption.pbe.StandardPBEStringEncryptor.decrypt(StandardPBEStringEncryptor.java:725)
parvaz.aero.commons.security.Encryptor.decrypt(Encryptor.java:64)
parvaz.aero.registration.staff.reset.ResetPassword.doGet(ResetPassword.java:34)
javax.servlet.http.HttpServlet.service(HttpServlet.java:626)
javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
这是我检查字符串是否加密的方法
public static boolean isStringEncrypted(String str) {
try {
decrypt(str);
return false;
}catch(Exception e) {
return true;
}
}
如果字符串未解密,我将在此处显示我的消息
if(!isTokenNull) {
String resetTokenEmail = Encryptor.decrypt(resetToken);
boolean isEmailEncrypted = Encryptor.isStringEncrypted(resetTokenEmail);
if(isEmailEncrypted) {
String form = ChangePasswordForm.displayForm(resetToken,"","");
out.println(SiteTemplate.webPage(form));
}
else {
out.println(SiteTemplate.webPage(Message.getExpired()));
}
}
else {
out.println(SiteTemplate.webPage(Message.getExpired()));
}
尽管显示了Message.getExpired(),为什么它会抛出HTTP Status 500 – Internal Server Error?
【问题讨论】:
标签: java exception encryption http-status-code-500 jasypt