JDK-4997193 : REGRESSION:JFileChooser throws NPE
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.6
  • CPU: sparc
  • Submitted: 2004-02-19
  • Updated: 2004-03-29
  • Resolved: 2004-02-19
Related Reports
Duplicate :  
Description

Name: apR10229			Date: 02/19/2004


Filed By      : SPB JCK team (###@###.###)
JDK           : JDK15-beta2-b37
JCK           : 1.5
Platform[s]   : SunOS 5.8
switch/Mode   : 
JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
Failing Test [s] :
    api/javax_swing/plaf/metal/MetalFileChooserUI/FilterComboBoxModel/index.html#Public[FilterComboBoxModel2003]


Problem description
===================
JCK API test
api/javax_swing/plaf/metal/MetalFileChooserUI/FilterComboBoxModel/index.html#Public[FilterComboBoxModel2003]
failed with JDK1.5-beta2-b37 with NPE on SunOS-5.8-sparc. Below is the minimized code that can help to reproduce this failure.
    
Minimized test:
===============
------- Test.java -------
import javax.swing.JFileChooser;
import javax.swing.plaf.metal.*;
import javax.swing.filechooser.FileFilter;
import java.io.File;

public class Test {
    public static void main(String[] argv) {
      for (int j=0; j<50; j++) {
	JFileChooser fileChooser = new JFileChooser();
	StubMetFCUI outer = new StubMetFCUI(fileChooser);
	outer.installUI(fileChooser);
	StubMetFCUI.StubFCBMod c = outer.new StubFCBMod();
	FileFilter filter = new CustomFilter();
	fileChooser.addChoosableFileFilter(filter);
	c.setSelectedItem(fileChooser.getChoosableFileFilters()[1]);
      }
    }
}

class StubMetFCUI extends MetalFileChooserUI {
  public class StubFCBMod extends FilterComboBoxModel {
    public StubFCBMod() {
      super();
    }
  }
  StubMetFCUI(JFileChooser fc) {
    super(fc);
  }
}

class CustomFilter extends FileFilter {
  public boolean accept(File f) {
    return true;
  }
  public String getDescription() {
    return "Custom filter";
  }
}; 

------- end-of-Test.java -------

Minimized test output:
======================
<pav@volvo(pts/24).257> java Test
Warning: Cannot convert string "-monotype-arial-regular-r-normal--*-140-*-*-p-*-iso8859-1" to type FontStruct
Exception in thread "main" java.lang.NullPointerException
        at javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1116)
        at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1059)
        at javax.swing.plaf.basic.BasicListUI$Handler.valueChanged(BasicListUI.java:2171)
        at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:187)
        at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:167)
        at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:214)
        at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:408)
        at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:417)
        at javax.swing.DefaultListSelectionModel.removeSelectionIntervalImpl(DefaultListSelectionModel.java:510)
        at javax.swing.DefaultListSelectionModel.clearSelection(DefaultListSelectionModel.java:422)
        at sun.swing.FilePane.clearSelection(FilePane.java:1244)
        at sun.swing.FilePane.doFilterChanged(FilePane.java:1166)
        at sun.swing.FilePane.propertyChange(FilePane.java:1202)
        at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:305)
        at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:242)
        at java.awt.Component.firePropertyChange(Component.java:7106)
        at javax.swing.JFileChooser.setFileFilter(JFileChooser.java:1406)
        at javax.swing.JFileChooser.addChoosableFileFilter(JFileChooser.java:1103)
        at Test.main(Test.java:14)
<pav@volvo(pts/24).258> 


JCK test source location:
==========================
/java/re/jck/1.5/promoted/latest/JCK-runtime-15/tests

Specific Machine Info:
=====================
SunOS volvo 5.8 Generic_108528-18 sun4u sparc SUNW,Sun-Blade-1000

Additional comments:
====================
This bug was reproduced on SunOS 5.8/sparc/jdk15-beta2-b37,38


======================================================================

Comments
EVALUATION Name: sh120115 Date: 02/19/2004 This looks like it may be a duplicate of 4997165. At a quick glance, it appears it may have been filed exactly the same twice. ###@###.### 2004-02-19 ======================================================================
19-02-2004