|Erratic Null Pointer Exception [message #1814023]
||Mon, 02 September 2019 02:56
| Dick Wissbaum
Registered: September 2019
I have an elusive Null Pointer bug.|
When I run my application, it terminates early with a Null Pointer Exception. It reports the source line where the error occurs and the trace back to main().
When I start the application using Debug, the debugger halts execution on the source line and at the same point where the Null Pointer Exception occurs. The Debug window reports that thread [main] execution has been suspended because of a Null Pointer Exception.
So far, I understand all of this. BUT when I set a breakpoint in the program before the exception occurs, the app completes successfully. This happens whether I step through one line at a time, or simply press resume.
Null pointer errors are hard enough to find - I have no hope of tracking it down without the debugger.
This is a Swing application, and the Debug window shows an AWT Event Queue thread running... Is it possible that I am trying to refer to a control in a Swing window before it has been instantiated? What is the significance of the code snippet "SwingUtilities.invokeLater(new Runnable()" I understand that this is the code that places the controls in my window. Do I need to do something explicit to insure that the window building is complete before I start to access the controls?
Powered by FUDForum
. Page generated in 0.03126 seconds