I am getting the following exception sometimes in my GUI. How can I
debug this? There is nothing from my code in the stack and the
exception is not easily reproducible. Any help will be greatly
appreciated.
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1064)
at
javax.swing.SwingGraphics.createSwingGraphics(SwingGraphics.java:147)
at javax.swing.JComponent._paintImmediately(JComponent.java:4670)
at javax.swing.JComponent.paintImmediately(JComponent.java:4488)
at
javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:410)
at
javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:117)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
java.lang.NullPointerException
at javax.swing.JComponent._paintImmediately(JComponent.java:4671)
at javax.swing.JComponent.paintImmediately(JComponent.java:4488)
at
javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:410)
at
javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:117)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
In paintImmediately null graphics
Mathias Lichtner - 19 Jul 2005 20:24 GMT
> I am getting the following exception sometimes in my GUI. How can I
> debug this? There is nothing from my code in the stack and the
> exception is not easily reproducible. Any help will be greatly
> appreciated.
[...]
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
> at
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
> at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
> In paintImmediately null graphics
last line, 'In paintImmediately null graphics', perhaps you have
modified your 'Graphics' in an overridden method like paintComponent
or modified it somewhere else?
Thomas Fritsch - 20 Jul 2005 01:18 GMT
>I am getting the following exception sometimes in my GUI. How can I
> debug this? There is nothing from my code in the stack and the
[quoted text clipped - 6 lines]
> at javax.swing.JComponent._paintImmediately(JComponent.java:4670)
> ...
Take a look at the source (in "src.zip" of your JDK installation) of
Thread.dumpStack()
/**
* Prints a stack trace of the current thread. This method is used
* only for debugging.
*/
public static void dumpStack() {
new Exception("Stack trace").printStackTrace();
}
You see, that the Exception is *not* thrown. It is just created to print a
stack trace, and the method returns normally. (May be some developer of the
SwingGraphics class has "forgotten" to remove a debugging line
"Thread.dumpStack();" before that JDK version was released.) So there is no
problem at all, and you can safely ignore it.
Of course, in your IDE-debugger you could set a breakpoint on
Thread.dumpStack() to see under which circumstances it happens. But I think
it is not worth the effort.

Signature
"TFritsch$t-online:de".replace(':','.').replace('$','@')