JDK-4990234 : NPE is thrown when JFlieChooser is loaded from the app thread
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2004-02-06
  • Updated: 2004-02-12
  • Resolved: 2004-02-12
Related Reports
Relates :  
Description

Name: apR10133			Date: 02/06/2004


If JFileChooser is loaded from the app thread BasicListUI.updateLayoutState
is called at the same time on two threads: main application thread and EDT.
Filechooser updates layout state on EDT after loading the files, at the
same time filechooser dialog is packed and validated on the main thread.
Method updateLayoutState is works with array cellHeights and resets it to
null at a couple of places. So, the main thread is trying to access the
data that is alredy set to null by EDT and we get the NPE.
======================================================================

Comments
EVALUATION Name: apR10133 Date: 02/10/2004 Both calls of updateLayoutState are valid. We could either enclose the content of updateLayoutState into synchronized block or deal with temporary _cellHeights in updateLayoutState and then assign it to cellHeights. ###@###.### ====================================================================== Name: apR10133 Date: 02/12/2004 Swing isn't thread safe. If we show filechooser's dilog from main thread (not EDT) the code invoke pack for it from the main thread and it causes NPE. This is not a bug. ###@###.### ======================================================================
24-08-2004

WORK AROUND Name: apR10133 Date: 02/06/2004 ======================================================================
24-08-2004