I work with sdk 1.4.2 on Win2000 on a gui/swing application.
Once in a while, randomly, appears the following stack trace::
java.lang.NullPointerException
at sun.awt.windows.WInputMethod.dispatchEvent(Unknown Source)
at sun.awt.im.InputContext.dispatchEvent(Unknown Source)
at sun.awt.im.InputMethodContext.dispatchEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
I haven't found the user event that triggers the error.
Not finding any of my classes involved, I fear it is an awt bug.
Has someone seen something similar?
Thank you,
Matteo
mdtorre@freemail.it wrote in comp.lang.java.gui:
> I work with sdk 1.4.2 on Win2000 on a gui/swing application.
> Once in a while, randomly, appears the following stack trace::
Are you working on an AWT or a Swing GUI? Those component
libraries do not mix well so you should always use only one
of them at a time.
> I haven't found the user event that triggers the error.
> Not finding any of my classes involved, I fear it is an awt bug.
> Has someone seen something similar?
A bug? Read this:
http://www.catb.org/~esr/faqs/smart-questions.html#id2790354
What happens that you are passing a null value to an AWT
GUI component. The component is then later triggered by the
event thread and it tries to access the null value and throws
the exception.
You've made a bug somewhere but it manifests itself much
later in a completely different place. Just one of the nice
features of multithreaded programs. Have a pleasant debugging
session. :-)

Signature
Antti S. Brax - asb(at)iki.fi Rullalautailu pitää lapset poissa ladulta
http://www.iki.fi/asb/ http://www.cs.helsinki.fi/u/abrax/hlb/
Thomas Weidenfeller - 18 Nov 2003 13:25 GMT
> mdtorre@freemail.it wrote in comp.lang.java.gui:
>> I work with sdk 1.4.2 on Win2000 on a gui/swing application.
[quoted text clipped - 3 lines]
> libraries do not mix well so you should always use only one
> of them at a time.
Swing uses parts of the AWT. So it is entirely possible to run into an
AWT bug when using Swing exclusively.
/Thomas
Matteo - 20 Nov 2003 20:13 GMT
> mdtorre@freemail.it wrote in comp.lang.java.gui:
> > I work with sdk 1.4.2 on Win2000 on a gui/swing application.
[quoted text clipped - 3 lines]
> libraries do not mix well so you should always use only one
> of them at a time.
Swing, only swing. Swing uses awt, but I do not use awt directly
> > I haven't found the user event that triggers the error.
> > Not finding any of my classes involved, I fear it is an awt bug.
[quoted text clipped - 7 lines]
> event thread and it tries to access the null value and throws
> the exception.
I pass nothing directly to awt ... and the only separate tread I use
(apart for the gui event thread) is a Timer, a thread that should not
cause strange problems
Matteo
Antti S. Brax - 21 Nov 2003 07:36 GMT
mdtorre@freemail.it wrote in comp.lang.java.gui:
>> mdtorre@freemail.it wrote in comp.lang.java.gui:
>> > I work with sdk 1.4.2 on Win2000 on a gui/swing application.
>> > Once in a while, randomly, appears the following stack trace::
>> What happens that you are passing a null value to an AWT
>> GUI component. The component is then later triggered by the
>> event thread and it tries to access the null value and throws
>> the exception.
>
> I pass nothing directly to awt ...
Sigh... Maybe you pass a null value to Swing then?
> and the only separate tread I use
> (apart for the gui event thread) is a Timer, a thread that should not
> cause strange problems
Did I say the exception originates from a thread _you_ control?
Check the stack trace again. The call stack starts from the
run method of java.awt.EventDispatchThread.
See if you can shrink your program to 20-30 lines that still
reproduce the exception and post the code here. Unless you can
do that there isn't much people here can do for you.

Signature
Antti S. Brax - asb(at)iki.fi Rullalautailu pitää lapset poissa ladulta
http://www.iki.fi/asb/ http://www.cs.helsinki.fi/u/abrax/hlb/