当前位置: 技术问答>java相关
捕捉了异常之后,如何能显示发生错误所在的位置
来源: 互联网 发布时间:2015-09-15
本文导语: 捕捉了异常之后,如何能显示发生错误所在的位置 现在我用catch(Exception e) 智能获得出错信息,java.lang.Exception: 移动的行,超出了范围! 但是不能知道是在哪一个类那一行出错, 例如这样的信息: There was 1 error: 1...
捕捉了异常之后,如何能显示发生错误所在的位置
现在我用catch(Exception e)
智能获得出错信息,java.lang.Exception: 移动的行,超出了范围!
但是不能知道是在哪一个类那一行出错,
例如这样的信息:
There was 1 error:
1) testCreateSyntax(MyTest)
java.lang.NullPointerException
at justnorth.report.DataAdapter.readData(DataAdapter.java:116)
at justnorth.report.DataAdapter.getData(DataAdapter.java:30)
at justnorth.report.CreateSyntax.createSql(CreateSyntax.java:73)
at MyTest.testCreateSyntax(MyTest.java:165)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at MyTest.main(MyTest.java:308)
how to ??????????????????????
现在我用catch(Exception e)
智能获得出错信息,java.lang.Exception: 移动的行,超出了范围!
但是不能知道是在哪一个类那一行出错,
例如这样的信息:
There was 1 error:
1) testCreateSyntax(MyTest)
java.lang.NullPointerException
at justnorth.report.DataAdapter.readData(DataAdapter.java:116)
at justnorth.report.DataAdapter.getData(DataAdapter.java:30)
at justnorth.report.CreateSyntax.createSql(CreateSyntax.java:73)
at MyTest.testCreateSyntax(MyTest.java:165)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at MyTest.main(MyTest.java:308)
how to ??????????????????????
|
at justnorth.report.DataAdapter.readData(DataAdapter.java:116)
at justnorth.report.DataAdapter.getData(DataAdapter.java:30)
at justnorth.report.CreateSyntax.createSql(CreateSyntax.java:73)
at MyTest.testCreateSyntax(MyTest.java:165)
这几句后面不是注明了异常产生的文件和具体的行数吗?最后的数字就是行数。应该是某个输入数据为NULL而导致了一个异常的产生
at justnorth.report.DataAdapter.getData(DataAdapter.java:30)
at justnorth.report.CreateSyntax.createSql(CreateSyntax.java:73)
at MyTest.testCreateSyntax(MyTest.java:165)
这几句后面不是注明了异常产生的文件和具体的行数吗?最后的数字就是行数。应该是某个输入数据为NULL而导致了一个异常的产生
|
顶..........
本来
java.lang.NullPointerException
at justnorth.report.DataAdapter.readData(DataAdapter.java:116)
at justnorth.report.DataAdapter.getData(DataAdapter.java:30)
at justnorth.report.CreateSyntax.createSql(CreateSyntax.java:73)
at MyTest.testCreateSyntax(MyTest.java:165)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
这些就是
e.printStackTrace()
打出来的结果,不然难道它自己生出来啊???
是zych72(闹闹) 自己没看清楚,错误跟踪都被打出来了..还在弄一次干啥???
本来
java.lang.NullPointerException
at justnorth.report.DataAdapter.readData(DataAdapter.java:116)
at justnorth.report.DataAdapter.getData(DataAdapter.java:30)
at justnorth.report.CreateSyntax.createSql(CreateSyntax.java:73)
at MyTest.testCreateSyntax(MyTest.java:165)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
这些就是
e.printStackTrace()
打出来的结果,不然难道它自己生出来啊???
是zych72(闹闹) 自己没看清楚,错误跟踪都被打出来了..还在弄一次干啥???