更新时间:2023-02-05 19:08:31
如果catch
块内的anotherMethodThrowingIllegalArgumentException()
调用可能引发异常,则应在此处捕获该异常,而不应将其作为***"
If the anotherMethodThrowingIllegalArgumentException()
call inside the catch
block may throw an exception it should be caught there, not as part of the "top level" try
statement:
public void method(){
try{
methodThrowingIllegalArgumentException();
return;
catch (IllegalArgumentException e) {
try {
anotherMethodThrowingIllegalArgumentException();
return;
} catch(IllegalArgumentException eee){
//do some
return;
}
} catch (SomeAnotherException ee){
return;
}
}