Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

can we see error description while debugging a java program  RSS feed

 
Sindhuri krish
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am debugging a java program to know the exact place where it fails. The program fails in line 20 but line 20 fails as line 19 fails.
So I am trying to know the failure reason for line 19.Line 19 is not an expression or not a variable but it give a call to a java api.

As the junit test fails only after Line 20, in the console of eclipse the message I see just says 'could not get data' and then failed at lines.
Is there any error method which I can use to print after line 19 to know what exactly is the error description.

thanks in advance for help
 
Greg Charles
Sheriff
Posts: 3015
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, we probably need more to go on. Why is line 20 failing because line 19 fails. Is line 19 returning a null value or something that line 20 tries to use? You're certainly welcome to post the code here, and we might be able to guess what the problem is. Don't post 100 lines of code, but posting 10 or 20 lines should be enough to demonstrate the problem.

Even a call to a Java API is an expression, and you can print out its value with print statements, or examine it in a debugger if you are using one. With a debugger you can even step into the Java API call, assuming you've got everything configured correctly so that the debugger can find the Java API source code.
 
Sindhuri krish
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Greg the problem was line 20 was trying to get a value from line 19 and I solved it now.Thanks for help



Greg Charles wrote:Actually, we probably need more to go on. Why is line 20 failing because line 19 fails. Is line 19 returning a null value or something that line 20 tries to use? You're certainly welcome to post the code here, and we might be able to guess what the problem is. Don't post 100 lines of code, but posting 10 or 20 lines should be enough to demonstrate the problem.

Even a call to a Java API is an expression, and you can print out its value with print statements, or examine it in a debugger if you are using one. With a debugger you can even step into the Java API call, assuming you've got everything configured correctly so that the debugger can find the Java API source code.


 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!