• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

JFileChooser: Exception while removing reference: java.lang.InterruptedException

 
Ranch Hand
Posts: 30
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I've been working lately on a Swing application. I created a simple generic form-like JDialog (Label - Input Text; ...; Lable - Input Text; Submit).
I devolope mainly on Ubuntu with Sun JDK 1.6 u24.

No issues have been identified but few days ago I compiled and run this app on Windows 7, with exactly the same java version and a problem occured.
Additional functionality is that the form allows user to choose a file. User clicks a JButton and a JFileChooser shows up. When OK is chosen absolute file path is displayed in a JTextField. Everything takes place in Event Driven Thread.

I implemented a Window Closing listener to dispose a main JFrame (and the form-like JDialog) and call System.exit(0). When the app is closed occasionaly the following exception is thrown by Java 2D Disposer thread (which seems to be some intenral mechanism):
This happens only when using JFileChooser. If there are only JLables and JTextFieldeverything works fine.
As a temp solution I advise System to run the GC and it works as well.

I tried to run jvisualvm to idetify all threads and objects but everytime I create a dump the problem does not occur.

I created a simple app which generates the Exception with similar frequency as my main app:


I googled a little but this issue does not seem to be popular.
I had upgraded Java version to the latest release u26 but it didn't change anything.

Can any of you please try to run this code and check if it happens ?

Thanks in advance
Rafal
 
Sheriff
Posts: 22849
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all, it's Event Dispatcher Thread, not Event Driver Thread.

It looks like there's some event still in the event queue. I'm not sure why; perhaps the setVisible(false) after the call to dispose(). It's unnecessary, as dispose() will already hide the dialog, so what happens if you remove this statement?

If that doesn't solve the problem, what steps do you need to take to reproduce it? Because I tried to get that error but no such luck. My steps:
- launch the application
- click the button
- select a file
- press OK in the JFileChooser
- either press OK in the main dialog or close it using the X
 
Rafal Kawecki
Ranch Hand
Posts: 30
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:First of all, it's Event Dispatcher Thread, not Event Driver Thread.

Sorry, my mistake. I have no idea why I wrote Driver

Rob Spoor wrote:It looks like there's some event still in the event queue. I'm not sure why; perhaps the setVisible(false) after the call to dispose(). It's unnecessary, as dispose() will already hide the dialog, so what happens if you remove this statement?

The same Exception was thrown.

Rob Spoor wrote:If that doesn't solve the problem, what steps do you need to take to reproduce it? Because I tried to get that error but no such luck. My steps:
- launch the application
- click the button
- select a file
- press OK in the JFileChooser
- either press OK in the main dialog or close it using the X

That is exactly what you need to do. That does not matter if you use X or OK.

Which OS do you use ? How many times did you try to run the app ?

Thanks
Rafal
 
Rafal Kawecki
Ranch Hand
Posts: 30
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dispose desc in Java 6 API says:

public void dispose()
Releases all of the native screen resources used by this Window, its subcomponents, and all of its owned children. ...


So i updated the code to:but still the same issue.
 
Rob Spoor
Sheriff
Posts: 22849
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use Windows 7 Pro 64-bit with Java 1.6.0_26 32-bit, and I tried at least 10 times. No errors at all.
 
Rafal Kawecki
Ranch Hand
Posts: 30
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The only difference is that I have the Windows Enterprise version.

I am not an advanced Swing GUI programmer but this code seems to be ok. Besides the error does not seem to be harmful, is it generated after all my operations are finished. Anyway, thanks for your help.
Rafal
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic