# HG changeset patch # User alexsch # Date 1417187820 -14400 # Node ID cdd7ab00a1e21a6d962ca12be2a06a1aec297c9d # Parent 64c048b63cea082872f663be83e1e086f0eead31 8031696: [macosx] TwentyThousandTest test failed with OOM Reviewed-by: serb, pchelko diff -r 64c048b63cea -r cdd7ab00a1e2 jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java --- 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); + } } }