On Thu, 8 Sep 2022 10:18:04 GMT, Jayathirth D V <[email protected]> wrote:

>> Tejesh R has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Updated based on review comments
>
> src/java.desktop/share/classes/sun/swing/FilePane.java line 1766:
> 
>> 1764:                 selectedFiles[0] = getFileChooser().getSelectedFile();
>> 1765:             }
>> 1766: 
> 
> Is this problem seen only when single file is selected? What happens when 
> more than one file is selected?
> By default, is MultiSelection enabled on JfileChooser?
> 
> In FilePane.java, i see that get/setSelectedFiles() is exclusively used when 
> multi-selection mode is enabled and get/setSelectedFile() is used when 
> multi-selection is not enabled. Using getSelectedFile() to change the state 
> when multi-selection is enabled might introduce state corruption issues in 
> other scenarios.

This problem occurs when user switch the mode from single selection to multi 
selection, that too on specified scenario. By default multiselection will be 
disabled. When user selects a file in single selection and then switch to multi 
selection the selected single file is not retained in selectedFiles (Even 
though its a single file). So In order to handle this situation, whenever user 
switch from any state to multiselection enabled state, the previously selected 
files(if present) is set to selectedFiles().

-------------

PR: https://git.openjdk.org/jdk/pull/9996

Reply via email to