JDK-8152677 : [macosx] All files filter can't be selected in JFileChooser
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 8u73,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: x86
  • Submitted: 2016-03-17
  • Updated: 2016-05-26
  • Resolved: 2016-04-28
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 9
9 b120Fixed
Related Reports
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_73"
Java(TM) SE Runtime Environment (build 1.8.0_73-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.73-b02, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Mac OS X 10.9.5

A DESCRIPTION OF THE PROBLEM :
The All files file filter can't be selected in the Open dialog or Save dialog on Mac OS X.

This means that for all intents and purposes, JFileChooser is broken on the Mac in Java 8, which also makes it impossible for us to use Java 8. This is a critical regression from Java 7 that hurts development of our Java-based product.

REGRESSION.  Last worked in version 7u76

ADDITIONAL REGRESSION INFORMATION: 
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a JFileChooser with one FileFilter, and set acceptAllFileFilterUsed to true, then create an Open dialog using the file chooser.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The user is able to select the All files file filter.
ACTUAL -
The user cannot select the All files file filter.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.JFileChooser;
import javax.swing.SwingUtilities;
import javax.swing.filechooser.FileFilter;
import java.io.File;

public class JFileChooserBug {

    public static void main(String[] args) {
        Runnable runnable = new Runnable() {
            public void run() {
                JFileChooser chooser = new JFileChooser(new File("Users/manne"));
                chooser.setAcceptAllFileFilterUsed(true);
                chooser.setDialogType(JFileChooser.OPEN_DIALOG);
                FileFilter txtFilter = new FileFilter() {
                    @Override
                    public boolean accept(File f) {
                        return f.getName().endsWith(".txt");
                    }

                    @Override
                    public String getDescription() {
                        return "Text files";
                    }
                };
                chooser.addChoosableFileFilter(txtFilter);
                chooser.setFileFilter(txtFilter);
                chooser.showOpenDialog(null);
            }
        };
        SwingUtilities.invokeLater(runnable);
    }
}
---------- END SOURCE ----------


Comments
Regression injected by fix for https://bugs.openjdk.java.net/browse/JDK-8031696
05-04-2016

Does it affect 8 GA, is it a regression in 8u/9 ?
28-03-2016

reproducible in jdk9
28-03-2016

Does it reproducible on 9?
24-03-2016