8019975: closed/javax/swing/JFileChooser/4966171/bug4966171.java throws java.io.NotSerializableException: javax.swing.plaf.basic.BasicFileChooserUI$AcceptAllFileFilter
Reviewed-by: alexsch
--- 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