JDK-4776197 : JFileChooser has an easy-to-fix but serious performance bug
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0_01
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2002-11-08
  • Updated: 2013-11-01
  • Resolved: 2011-03-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b15Fixed
Related Reports
Relates :  
Relates :  
Description
JFileChooser.addChoosableFileFilter() calls setFileFilter(filter) on _every_
filter that is added, which results in an evaluation of every filter, 
in turn goes to the filesystem for each filter.

Comments
EVALUATION Method JFileChooser.addChoosableFileFilter sets FileFilter only if it's called for the first time. Otherwise this method doesn't change current FileFilter.
18-04-2007

SUGGESTED FIX In addition to the main bug, a second but less serious bug may also be addressed (see below). 1. addChoosableFileFilter() calls setFileFilter(filter) on _every_ filter that is added, which results in an evaluation of every filter, which in turn goes to the filesystem for each filter. If the application does not explicitly call setFileFilter(), then the first filter should be selected as an efficient lazy default. Also, if the semantic is to be 'if there is a filefilter then one must be selected' then when the currently selected is removed, a filter (again perhaps the first one) should be selected. Alternatively, if no filter is explicitly selected or the currently selected filter is removed, then the selected filter should be null. 2. It is not clear why the selectedFiles array is cloned in getSelectedFiles() when the public setSelectedFiles() method does not clone the passed value and so it shares the value with the application. 2. It is not clear why the selectedFiles array is cloned in getSelectedFiles() when the public setSelectedFiles() method does not clone the passed value and so it shares the value with the application; either setSelectedFiles() should clone the parameter or getSelectedFiles() should not clone. -------------------------------------------------------------------------------
25-09-2004

EVALUATION Will try to fix in the next release after mantis. ###@###.### 2002-12-16
16-12-2002