| Not getting nullpointer's stack trace on console (java code) [message #987595] |
Tue, 27 November 2012 04:53  |
Antti Rumpunen Messages: 5 Registered: November 2012 |
Junior Member |
|
|
Hi,
I have an annoying problem: Eclipse doesn't print stacktrack to the console if there is a nullpointer exception. However, I do get stacktrace if some other exception happens... And used to have nullpointer exceptions on the console before. I have no idea why I don't get them anymore.
When a nullpointer occurs Eclipse stops executing the thread (in debug-tab's thread listing) at EventDispatchTread.run() -methods third last line (line 156). On that line there is only }.
Unfortunately I can't provide a screenshot...
I'm using Indigo Service Release 2 and coding with java 6.
|
|
|
|
|
|
| Re: Not getting nullpointer's stack trace on console (java code) [message #988297 is a reply to message #988254] |
Thu, 29 November 2012 05:13   |
Antti Rumpunen Messages: 5 Registered: November 2012 |
Junior Member |
|
|
I tested with a simple code (Integer i = null; if(i>0)) which will cause a nullpointer every time I press a button. The code is executed twice by the same thread every time I press the button. Sometimes I get two nullpointer stack traces on the console (without Eclipse stopping the AWT-EventQueue-0 thread) and sometimes I get only one stack trace on the console and Eclipse stopping the AWT-EventQueue-0 thread.
Here is what Eclipse shows me...
Thread...
Thread...
Thread [AWT-EventQueue-0] (Suspended (exception NullPointerException))
EventDispatchThread.run() line:156 [local variables unavailable]
Thread...
Thread...
I can't provide the real code because there is thousands of lines of code and I have no idea where the nullpointer comes from. I debugged what the thread (AWT-EventQueue-0) is doing after I press the button (not my test button). The whole execution goes well. But once the thread starts to do something else (no idea what) I get the nullpointer (with Eclipse stopping the thread every time)...
[Updated on: Thu, 29 November 2012 05:14] Report message to a moderator
|
|
|
|
|
|
| Re: Not getting nullpointer's stack trace on console (java code) [message #988325 is a reply to message #988317] |
Thu, 29 November 2012 07:06  |
Antti Rumpunen Messages: 5 Registered: November 2012 |
Junior Member |
|
|
Hehheh, didn't know that you could set that kind of breakpoints... Problem solved. Thanks Ed!
There was the following piece of code in which window was null. No idea why the focus is set like that (not my code). And the reason why Eclipse doesn't show stacktrace to that line is probably something that needs more indepth understanding about threads etc.
EventQueue.invokeLater(new Runnable()
{
public void run()
{
window.setFocus();
}
});
|
|
|
Powered by
FUDForum. Page generated in 0.02083 seconds