On Thu, 22 Sep 2022 12:48:14 GMT, Abhishek Kumar <[email protected]> wrote:
> When a user selects ../ from directory list in GTK FileChooser continuosly,
> it leads to '../../../.....' in combobox and selection textarea even though
> it the current directory is at root level.
>
> Fix for the issue is to check if current directory is root then don't process
> the selection of ' ../ '.
>
> Test case has been added and checked in CI pipeline. Link is attached in JBS.
src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java
line 436:
> 434: int index = list.locationToIndex(e.getPoint());
> 435: File currentDirectory =
> getFileChooser().getCurrentDirectory();
> 436: if (currentDirectory.getParentFile() == null && index ==
> 1) {
Adding a Comment explaining the statement `index == 1` would be better to
understand that it signifies root directory index.
test/jdk/javax/swing/JFileChooser/TestFileChooserDirectorySelection.java line
71:
> 69: passed = true;
> 70: break;
> 71: } else if (++i > 5) {
Retries will be 4 right......? Since you are starting with 2 till 5......?
-------------
PR: https://git.openjdk.org/jdk/pull/10390