Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Strange gui error

0 views
Skip to first unread message

Matteo

unread,
Nov 18, 2003, 3:47:58 AM11/18/03
to
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

Antti S. Brax

unread,
Nov 18, 2003, 4:47:57 AM11/18/03
to
mdt...@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. :-)

--
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

unread,
Nov 18, 2003, 8:25:56 AM11/18/03
to
a...@iki.fi.NO.SPAM (Antti S. Brax) writes:
> mdt...@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.

Swing uses parts of the AWT. So it is entirely possible to run into an
AWT bug when using Swing exclusively.


/Thomas

Matteo

unread,
Nov 20, 2003, 3:13:14 PM11/20/03
to
a...@iki.fi.NO.SPAM (Antti S. Brax) wrote in message news:<slrnbrjqm...@kruuna.Helsinki.FI>...

> mdt...@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.

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.
> > 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.


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

unread,
Nov 21, 2003, 2:36:56 AM11/21/03
to
mdt...@freemail.it wrote in comp.lang.java.gui:

> a...@iki.fi.NO.SPAM (Antti S. Brax) wrote in message news:<slrnbrjqm...@kruuna.Helsinki.FI>...
>> mdt...@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.

0 new messages