• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hidden Swing exceptions

 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I found a really annoying bug today in our application. It was a NullPointerException in a table cell renderer. The visible effect of the bug was that some component was only partially visible or not visible at all and the component didn't refreshed itself(only when I dragged the window off the screen and then back).
I've spent more than an hour by commenting out and back lines from the code to find that the NullPointerException in the cell renderer caused the bug. At this time I was lucky, since I was able to locate the bug, but I still had to spend more than an hour with it. Usually Swing prints stack trace on the console, when an exception occures, but not in this case. Can anybody tell me why? Is there a good solution to find these bugs somehow?
I was searching a little bit, and I've found the following code, but it didn't work for this case.


Thanks in advance
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Miklos Szeles wrote: a NullPointerException in a table cell renderer. The visible effect of the bug was that some component was only partially visible or not visible at all and the component didn't refreshed itself(only when I dragged the window off the screen and then back).


Looks like a concurrency issue. Does the code respect Swing's single threaded rule?
 
Miklos Szeles
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your answer Darryl.
I made a small test program for the case and I found that it works fine. I compared the stack traces and at last I found that the only difference is that we use a custom EventQueue in our application. And the problem was there. For some unknown reason somebody put a try catch block in the dispatchEvent method which swallowed the NullPointerException without any log.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

For some unknown reason somebody put a try catch block in the dispatchEvent method which swallowed the NullPointerException without any log.


Welcome to the amazing world of programming
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic