且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

未报告的异常java.lang.exception

更新时间: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)中的另一篇有趣的读物