Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / November 2003

Tip: Looking for answers? Try searching our database.

Strange gui error

Thread view: 
Matteo - 18 Nov 2003 08:47 GMT
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 - 18 Nov 2003 09:47 GMT
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/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.