更新时间:2023-01-15 17:27:05
你的加密()
方法抛出异常
。这意味着,在您调用此方法的地方,您应该明确地抛出此异常
或使用 try-catch
来处理它>阻止。
Your encrypt()
method throws an Exception
. This means that where you're calling this method, you should explictly throw this Exception
or handle it using a try-catch
block.
在您的情况下,对于此特定代码:
In your case, for this particular code:
byte[] pass = encrypt(password);
String pw = new String(pass);
您应该将其括在:
try{
byte[] pass = encrypt(password);
String pw = new String(pass);
}catch(Exception exe){
//Your error handling code
}
或声明用括起此代码的方法抛出异常
。
如果您不熟悉异常处理,请考虑阅读:课程:Java教程的例外情况
此外,这是关于异常传播指南(Java)中的另一篇有趣的读物