8019975: closed/javax/swing/JFileChooser/4966171/bug4966171.java throws java.io.NotSerializableException: javax.swing.plaf.basic.BasicFileChooserUI$AcceptAllFileFilter
authormalenkov
Mon, 22 Jul 2013 15:36:30 +0400
changeset 19018 14d6859b9dcc
parent 18764 12a1993f109b
child 19019 622c39d5e9ee
8019975: closed/javax/swing/JFileChooser/4966171/bug4966171.java throws java.io.NotSerializableException: javax.swing.plaf.basic.BasicFileChooserUI$AcceptAllFileFilter Reviewed-by: alexsch
jdk/src/share/classes/javax/swing/JFileChooser.java
--- a/jdk/src/share/classes/javax/swing/JFileChooser.java	Mon Jul 15 17:33:44 2013 +0400
+++ b/jdk/src/share/classes/javax/swing/JFileChooser.java	Mon Jul 22 15:36:30 2013 +0400
@@ -1149,9 +1149,10 @@
         int index = filters.indexOf(f);
         if (index >= 0) {
             if(getFileFilter() == f) {
-                if (isAcceptAllFileFilterUsed()) {
+                FileFilter aaff = getAcceptAllFileFilter();
+                if (isAcceptAllFileFilterUsed() && (aaff != f)) {
                     // choose default filter if it is used
-                    setFileFilter(getAcceptAllFileFilter());
+                    setFileFilter(aaff);
                 }
                 else if (index > 0) {
                     // choose the first filter, because it is not removed