您的位置:首页 > 编程语言 > Java开发

java 空指针异常其他原因

2016-03-02 15:17 387 查看
空指针异常(可能由其他原因引起),打印真正异常:

private static void handleException(Exception e)
{
String msg = null;
if (e instanceof InvocationTargetException)
{
Throwable targetEx = ((InvocationTargetException) e)
.getTargetException();
if (targetEx != null)
{
msg = targetEx.getMessage();
}
} else
{
msg = e.getMessage();
}
MessageDialog.openError(Activator.getDefault().getWorkbench()
.getDisplay().getActiveShell(), "error", msg);
e.printStackTrace();
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: