On Tue, 6 Sep 2022 11:14:49 GMT, Tejesh R <[email protected]> wrote:
>> JFileChooser.getSelectedFiles() failed to retrieve files with
>> multi-selection and double-click. This occurs when a single file is selected
>> then enable multi-selection then select the same file through mouse
>> double-click(Two file chooser dialogs used before and after multi-selection
>> enabled). SelectedFiles are updated when a change in files/directory
>> selection is done or when selection is made through keyboard selection. In
>> this case since a single file is selected before multi-selection is enabled
>> and same file is selected again without changing the selection
>> index/directory, leaving selected Files un-updated.
>> **Proposed Fix** : Whenever Multi-Selection is enabled check if any files
>> are selected, if yes update the selected Files of JFileChoooser.
>
> Tejesh R has updated the pull request incrementally with one additional
> commit since the last revision:
>
> Updated based on review comments
test/jdk/javax/swing/JFileChooser/MultiSelectionEnabledSelectedFilesTest.java
line 39:
> 37: * @run main/manual MultiSelectionEnabledSelectedFilesTest
> 38: */
> 39: public class MultiSelectionEnabledSelectedFilesTest {
Is this bug specific to any platform?
Because the test is created to run on all platforms and it doesnt fail in my
Mac.
test/jdk/javax/swing/JFileChooser/MultiSelectionEnabledSelectedFilesTest.java
line 56:
> 54: static void runTest() {
> 55: //Initialize the components
> 56: String INSTRUCTIONS
Instruction should be updated to specify that we need to use double-click.
Also when i select a file using double click in first and then select same file
using double-click(without moving mouse) test doesnt exit. JFileChooser second
dialog just stays on the screen.
test/jdk/javax/swing/JFileChooser/MultiSelectionEnabledSelectedFilesTest.java
line 87:
> 85: File[] files = chooser.getSelectedFiles();
> 86:
> 87: if (files.length <= 0) {
Can File[] length be negative? I think just a "==" to "0" check should suffice.
-------------
PR: https://git.openjdk.org/jdk/pull/9996