小编Bil*_*ill的帖子

NullPointerException:每个异常都不包含原因吗?

我已经尝试在普遍的情况下调用此异常,默认情况下在我的应用程序中调用:

String causeClass = e.getCause().getClass().getName();
Run Code Online (Sandbox Code Playgroud)

但我得到了NullPointerException.

有没有一种安全的方法来查找原因并获取原因异常的类名?

java exception-handling nullpointerexception

5
推荐指数
1
解决办法
1631
查看次数