8031696: [macosx] TwentyThousandTest test failed with OOM
Reviewed-by: serb, pchelko
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java Fri Nov 28 14:03:56 2014 +0300
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java Fri Nov 28 19:17:00 2014 +0400
@@ -1300,12 +1300,12 @@
filters = (FileFilter[]) e.getNewValue();
fireContentsChanged(this, -1, -1);
} else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
- fireContentsChanged(this, -1, -1);
+ setSelectedItem(e.getNewValue());
}
}
public void setSelectedItem(Object filter) {
- if(filter != null) {
+ if (filter != null && !containsFileFilter(filter)) {
getFileChooser().setFileFilter((FileFilter) filter);
fireContentsChanged(this, -1, -1);
}
@@ -1353,6 +1353,10 @@
}
}
+ private boolean containsFileFilter(Object fileFilter) {
+ return Objects.equals(fileFilter, getFileChooser().getFileFilter());
+ }
+
/**
* Acts when FilterComboBox has changed the selected item.
*/
@@ -1363,7 +1367,10 @@
}
public void actionPerformed(final ActionEvent e) {
- getFileChooser().setFileFilter((FileFilter) filterComboBox.getSelectedItem());
+ Object selectedFilter = filterComboBox.getSelectedItem();
+ if (!containsFileFilter(selectedFilter)) {
+ getFileChooser().setFileFilter((FileFilter) selectedFilter);
+ }
}
}