【发布时间】:2018-04-07 02:49:23
【问题描述】:
我有如下的 catch 块
try {
// the function that can throw exception
} catch (InterruptedException | InterruptedIOException e) {
return false;
} catch (Exception e) {
Log.e(TAG, "Error ", e);
failure++;
}
但是如果一个 IOException 被抛出,它不会被捕获并且应用程序正在崩溃。 我认为它会被第二次捕获
【问题讨论】:
-
它将被第二个
Exceptioncatch 块捕获。只要第二个Exception是java.lang.Exception。有了给定的信息,就不可能相信你。粘贴更多代码。我怀疑你的部分代码也抛出异常 -
我已经编辑了代码。对于相同的 try 和 Exception,它的 2 个 catch 块是 Java.lang.Exception
标签: java android exception try-catch