阅读背景:

java 空指针异常其他原因

来源:互联网 

空指针异常(可能由其他原因引起),打印真正异常:

   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();
    }   private s



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: