Cannot open window for load, save or beginlogs

Thanks (from soutwestern europe), at least there is a good new tonight:slight_smile:

Here is a zip archive containing another test for you to run.

Unzip the archive. (Iā€™m assuming you will do this in Downloads.)

Then run the following:

"C:\Program Files\VASSAL-3.6.14\jre\bin\java.exe" --patch-module java.base=Downloads/arraydump -cp Downloads/arraydump Test

This should print you some lines of output between lines which say -- BEGIN -- and -- END --. Hereā€™s what I see when I run it:

When you run it, you should also get as output the error message youā€™ve been seeing, following -- END --.

This output should reveal what I need to know for reproducing the problem myself.

This is the first part of the result of running the test. When I tried one post, the text exceed the number of characters (30000). So I am spliting in two halfs. I think that when I copy the text, there are a lot of spaces added in each line (after pasting). And the text is too long for a single screenshot.

C:\Users\duduy>ā€œC:\Program Files\VASSAL-3.6.14\jre\bin\java.exeā€ --patch-module java.base=Downloads/arraydump -cp Downloads/arraydump Test
ā€“ BEGIN ā€“
Este equipo sun.awt.shell.Win32ShellFolder2
Red sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Documents sun.awt.shell.Win32ShellFolder2
C:\Users\duduy sun.awt.shell.Win32ShellFolder2
Bibliotecas sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\OneDrive sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Documents\MEGAsync sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Dropbox sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Music sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Downloads sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Pictures sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Videos sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\Curse of Strahd - Acceso directo.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\Darkest DungeonĀ®.url sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\descuento vodafone 2021-2022.txt sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\Discord.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\gasolina 2021.rtf sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\ISDEFE.txt sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\MEGAsync.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\Microsoft Teams.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\Navegador Opera.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\Night in the Woods.url sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\para imprimir sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\Personal - Edge.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\Precio bus VS electrico.txt sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\result 3.txt sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\Solicitud Voto correo elecciones 2021.pdf sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\Stellaris.url sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\Sunless Sea.url sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\uncaught exception.jpg sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\VASSAL 3.4.6.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\VASSAL 3.6.14.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\Public\Desktop\Adobe Acrobat.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\Public\Desktop\Avira.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\Public\Desktop\Brother Utilities.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\Public\Desktop\calibre 64bit - E-book management.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\Public\Desktop\Epic Games Launcher.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\Public\Desktop\Google Chrome.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\Public\Desktop\Microsoft Edge.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\Public\Desktop\Paradox Launcher.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\Public\Desktop\Steam.lnk sun.awt.shell.Win32ShellFolder2
ā€“ END ā€“

And there, the second part:

ā€“ BEGIN ā€“
Este equipo sun.awt.shell.Win32ShellFolder2
Red sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Documents sun.awt.shell.Win32ShellFolder2
C:\Users\duduy sun.awt.shell.Win32ShellFolder2
Bibliotecas sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\OneDrive sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Documents\MEGAsync sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Dropbox sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Music sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Downloads sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Pictures sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Videos sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Documents sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\Curse of Strahd - Acceso directo.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\Darkest DungeonĀ®.url sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\descuento vodafone 2021-2022.txt sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\Discord.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\gasolina 2021.rtf sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\ISDEFE.txt sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\MEGAsync.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\Microsoft Teams.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\Navegador Opera.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\Night in the Woods.url sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\para imprimir sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\Personal - Edge.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\Precio bus VS electrico.txt sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\result 3.txt sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\Solicitud Voto correo elecciones 2021.pdf sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\Stellaris.url sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\Sunless Sea.url sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\uncaught exception.jpg sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\VASSAL 3.4.6.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\duduy\Desktop\VASSAL 3.6.14.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\Public\Desktop\Adobe Acrobat.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\Public\Desktop\Avira.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\Public\Desktop\Brother Utilities.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\Public\Desktop\calibre 64bit - E-book management.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\Public\Desktop\Epic Games Launcher.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\Public\Desktop\Google Chrome.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\Public\Desktop\Microsoft Edge.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\Public\Desktop\Paradox Launcher.lnk sun.awt.shell.Win32ShellFolder2
C:\Users\Public\Desktop\Steam.lnk sun.awt.shell.Win32ShellFolder2
ā€“ END ā€“
java.lang.IllegalArgumentException: Comparison method violates its general contract! at java.base/java.util.ComparableTimSort.mergeHi(ComparableTimSort.java:870) at java.base/java.util.ComparableTimSort.mergeAt(ComparableTimSort.java:487) at java.base/java.util.ComparableTimSort.mergeForceCollapse(ComparableTimSort.java:426) at java.base/java.util.ComparableTimSort.sort(ComparableTimSort.java:222) at java.base/java.util.Arrays.sort(Arrays.java:1054) at java.desktop/sun.awt.shell.Win32ShellFolderManager2.get(Win32ShellFolderManager2.java:315) at java.desktop/sun.awt.shell.ShellFolder.get(ShellFolder.java:274) at java.desktop/com.sun.java.swing.plaf.windows.WindowsFileChooserUI$DirectoryComboBoxModel.addItem(WindowsFileChooserUI.java:1123) at java.desktop/com.sun.java.swing.plaf.windows.WindowsFileChooserUI.doDirectoryChanged(WindowsFileChooserUI.java:777) at java.desktop/com.sun.java.swing.plaf.windows.WindowsFileChooserUI$11.propertyChange(WindowsFileChooserUI.java:868) at java.desktop/java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:343) at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:335) at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:268) at java.desktop/java.awt.Component.firePropertyChange(Component.java:8716) at java.desktop/javax.swing.JFileChooser.setCurrentDirectory(JFileChooser.java:610) at Test.lambda$main$0(Test.java:21) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:308) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Unfortunately I canā€™t create locally any of the objects I need for troubleshooting, so Iā€™ll need more diagnostic output from you. Iā€™ve uploaded another version of arraydump.zip.

Please use the same command line as the previous time:

"C:\Program Files\VASSAL-3.6.14\jre\bin\java.exe" --patch-module java.base=Downloads/arraydump -cp Downloads/arraydump Test

The output I need this time is only what is between the -- BEGIN -- and -- END -- immediately above the error message. If there is more than one such block, the only one I need is the last one. The output this time will have some numbers produced from comparing the directory entries being sorted, and it should be possible to see from this which comparisons are incorrect.

Thank you for your persistence in running tests.

The resutls are here:

ā€“ BEGIN ā€“ Este equipo Red C:\Users\duduy\Documents C:\Users\duduy Bibliotecas C:\Users\duduy\OneDrive C:\Users\duduy\Documents\MEGAsync C:\Users\duduy\Dropbox C:\Users\duduy\Music C:\Users\duduy\Downloads C:\Users\duduy\Pictures C:\Users\duduy\Videos C:\Users\duduy\Desktop C:\Users\duduy\Documents C:\Users\duduy\Desktop\Curse of Strahd - Acceso directo.lnk C:\Users\duduy\Desktop\Darkest DungeonĀ®.url C:\Users\duduy\Desktop\descuento vodafone 2021-2022.txt C:\Users\duduy\Desktop\Discord.lnk C:\Users\duduy\Desktop\gasolina 2021.rtf C:\Users\duduy\Desktop\ISDEFE.txt C:\Users\duduy\Desktop\MEGAsync.lnk C:\Users\duduy\Desktop\Microsoft Teams.lnk C:\Users\duduy\Desktop\Navegador Opera.lnk C:\Users\duduy\Desktop\Night in the Woods.url C:\Users\duduy\Desktop\para imprimir C:\Users\duduy\Desktop\Personal - Edge.lnk C:\Users\duduy\Desktop\Precio bus VS electrico.txt C:\Users\duduy\Desktop\result 3.txt C:\Users\duduy\Desktop\Solicitud Voto correo elecciones 2021.pdf C:\Users\duduy\Desktop\Stellaris.url C:\Users\duduy\Desktop\Sunless Sea.url C:\Users\duduy\Desktop\uncaught exception.jpg C:\Users\duduy\Desktop\VASSAL 3.4.6.lnk C:\Users\duduy\Desktop\VASSAL 3.6.14.lnk C:\Users\Public\Desktop\Adobe Acrobat.lnk C:\Users\Public\Desktop\Avira.lnk C:\Users\Public\Desktop\Brother Utilities.lnk C:\Users\Public\Desktop\calibre 64bit - E-book management.lnk C:\Users\Public\Desktop\Epic Games Launcher.lnk C:\Users\Public\Desktop\Google Chrome.lnk C:\Users\Public\Desktop\Microsoft Edge.lnk C:\Users\Public\Desktop\Paradox Launcher.lnk C:\Users\Public\Desktop\Steam.lnk 0 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 0 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -2 -3 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 0 1 -9 -19 -8 -6 -10 -9 -7 -8 -10 -45 -29 -41 -20 -26 -19 -21 -28 -28 -31 -22 -28 -36 -21 -50 -22 -24 -31 -25 -26 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 9 1 0 11 11 2 11 -1 -7 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 19 1 -11 0 -3 -9 -20 -12 -18 10 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 8 1 -11 3 0 -9 3 -12 -18 13 3 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 6 1 -2 9 9 0 9 -3 -9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 10 1 -11 20 -3 -9 0 -12 -18 10 20 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 9 1 1 12 12 3 12 0 -6 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 7 1 7 18 18 9 18 6 0 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 8 1 -11 -10 -13 -9 -10 -12 -18 0 -10 -37 -21 -33 -12 -18 -11 -13 -20 -20 -23 -14 -20 -28 -13 -42 -14 -16 -23 -17 -18 -12 -12 -12 -12 -12 -12 -12 -12 -12 -2 -3 0 10 -1 -11 -9 -3 -9 -20 -12 -18 10 0 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 45 1 -11 -10 -13 -9 -10 -12 -18 37 -10 0 -1 -1 -1 -4 -6 -10 -10 -11 -11 -13 -13 -13 -15 -16 -16 -16 -18 -19 -19 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 29 1 -11 -10 -13 -9 -10 -12 -18 21 -10 1 0 -4 -8 -3 -5 -9 -9 -10 -10 -12 -12 -12 -14 -15 -15 -15 -17 -18 -18 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 41 1 -11 -10 -13 -9 -10 -12 -18 33 -10 1 4 0 -4 -3 -5 -9 -9 -10 -10 -12 -12 -12 -14 -15 -15 -15 -17 -18 -18 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 20 1 -11 -10 -13 -9 -10 -12 -18 12 -10 1 8 4 0 -3 -5 -9 -9 -10 -10 -12 -12 -12 -14 -15 -15 -15 -17 -18 -18 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 26 1 -11 -10 -13 -9 -10 -12 -18 18 -10 4 3 3 3 0 -2 -6 -6 -7 -7 -9 -9 -9 -11 -12 -12 -12 -14 -15 -15 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 19 1 -11 -10 -13 -9 -10 -12 -18 11 -10 6 5 5 5 2 0 -4 -4 -5 -5 -7 -7 -7 -9 -10 -10 -10 -12 -13 -13 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 21 1 -11 -10 -13 -9 -10 -12 -18 13 -10 10 9 9 9 6 4 0 -4 -1 -1 -3 -3 -3 -5 -6 -6 -6 -8 -9 -9 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 28 1 -11 -10 -13 -9 -10 -12 -18 20 -10 10 9 9 9 6 4 4 0 -1 -1 -3 -3 -3 -5 -6 -6 -6 -8 -9 -9 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 28 1 -11 -10 -13 -9 -10 -12 -18 20 -10 11 10 10 10 7 5 1 1 0 -8 -2 -2 -2 -4 -5 -5 -5 -7 -8 -8 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 31 1 -11 -10 -13 -9 -10 -12 -18 23 -10 11 10 10 10 7 5 1 1 8 0 -2 -2 -2 -4 -5 -5 -5 -7 -8 -8 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 22 1 -11 -10 -13 -9 -10 -12 -18 14 -10 13 12 12 12 9 7 3 3 2 2 0 -4 -17 -2 -3 -3 -3 -5 -6 -6 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 28 1 -11 -10 -13 -9 -10 -12 -18 20 -10 13 12 12 12 9 7 3 3 2 2 4 0 -13 -2 -3 -3 -3 -5 -6 -6 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 36 1 -11 -10 -13 -9 -10 -12 -18 28 -10 13 12 12 12 9 7 3 3 2 2 17 13 0 -2 -3 -3 -3 -5 -6 -6 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 21 1 -11 -10 -13 -9 -10 -12 -18 13 -10 15 14 14 14 11 9 5 5 4 4 2 2 2 0 -1 -1 -1 -3 -4 -4 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 50 1 -11 -10 -13 -9 -10 -12 -18 42 -10 16 15 15 15 12 10 6 6 5 5 3 3 3 1 0 -5 -6 -2 -3 -3 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 22 1 -11 -10 -13 -9 -10 -12 -18 14 -10 16 15 15 15 12 10 6 6 5 5 3 3 3 1 5 0 -1 -2 -3 -3 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 24 1 -11 -10 -13 -9 -10 -12 -18 16 -10 16 15 15 15 12 10 6 6 5 5 3 3 3 1 6 1 0 -2 -3 -3 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 31 1 -11 -10 -13 -9 -10 -12 -18 23 -10 18 17 17 17 14 12 8 8 7 7 5 5 5 3 2 2 2 0 -1 -1 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 25 1 -11 -10 -13 -9 -10 -12 -18 17 -10 19 18 18 18 15 13 9 9 8 8 6 6 6 4 3 3 3 1 0 -2 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 26 1 -11 -10 -13 -9 -10 -12 -18 18 -10 19 18 18 18 15 13 9 9 8 8 6 6 6 4 3 3 3 1 2 0 -12 -12 -12 -12 -12 -12 -12 -12 -12 1 1 1 12 1 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 0 -18 -1 -2 -4 -6 -12 -15 -18 1 1 1 12 1 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 18 0 -1 -2 -4 -6 -12 -15 -18 1 1 1 12 1 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 1 1 0 -1 -3 -5 -11 -14 -17 1 1 1 12 1 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 2 2 1 0 -2 -4 -10 -13 -16 1 1 1 12 1 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 4 4 3 2 0 -2 -8 -11 -14 1 1 1 12 1 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 6 6 5 4 2 0 -6 -9 -12 1 1 1 12 1 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 11 10 8 6 0 -3 -6 1 1 1 12 1 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 15 15 14 13 11 9 3 0 -3 1 1 1 12 1 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 18 18 17 16 14 12 6 3 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 ā€“ END ā€“

Seems taht the format of the number matrix is dismanteled when posted. So I upload this screenshoot of the matrix as prompt in command line.

There is a 1 outside position in line and columns 14th and 3rd (symetriacly). If I have counted well. Unfortunatly, I do not foresee the meaning, so I will wait your answer.

2 Likes

Thanks to your help, we now know whatā€™s wrong. Hereā€™s the explanation:

The items which are causing the sort function to have an error are of type Win32ShellFolder2, which you can see here. Theyā€™re buried in the JDK and are something which is not normally accessible, which is why we had such a hard time prying out any information about them.

There are two functions required for sorting: compareTo() and equals(). a.compareTo(b) is supposed to return a number < 0 if a < b, 0 if a equals b, and a number > 0 if a > b. a.equals(b) is supposed to return true if a equals b and false if not.

The first large block of numbers from the last test is the result of a.compareTo(b) for each pair of items being sorted. The second large block of numbers is the result of a.equals(b) for each pair. As youā€™d expect, there are ones (1 is true, 0 is false) along the diagonal of the equals() block because thatā€™s the result for a.equals(a). Well done for spotting the pair of ones which are not on the diagonal. Those are involved in the problem. The two paths from the list of items which are third and fourteenth are, respectively C:\Users\duduy\Documents andā€¦ C:\Users\duduy\Documents! They appear to be the same. It makes sense that youā€™d have a pair of stray ones off the diagonal if you have a duplicate in the list, so this is not in and of itself a problem. However, these two entries are involved in the problem, and the fact that they are considered equal plays a key role.

Let a be the first C:\Users\duduy\Documents, b the second, and c be C:\Users\duduy. According to the last test you ran,

a.compareTo(c) == -1
b.compareTo(c) == 10
a.compareTo(b) == 0

So a < c, c < b, andā€¦ OH NO! a = b. Which means that a < c and a > c, so we have a cycle in our ordering. This is the thing which causes the exception which ultimately prevents you from opening the file dialog. The relation induced by compareTo absolutely must be a linear order, and this relation is not.

What in the code causes the bug? Something I havenā€™t mentioned yet is how it can be that a equals b but one ends up less than c and the other greater. Letā€™s look at whatā€™s in Win32ShellFolder2.equals(). The important part is this:

if (isFileSystem() && rhs.isFileSystem()) {
    // Only folders with identical parents can be equal
    return (pathsEqual(getPath(), rhs.getPath()) &&
            (parent == rhs.parent || parent.equals(rhs.parent)));
}

If both a and b are real directories on the file system, whether they are considered equal depends on whether their paths are equalā€”and in the case of a and b, they are.

There is a difference between a and b, however, and itā€™s something that equals() doesnā€™t check: a.isSpecial() is true, but b.isSpecial() is false. This turns out to matter, because compareTo() checks isSpecial().

The relevant line in compareTo() is this one,

return Win32ShellFolderManager2.compareShellFolders(this, (Win32ShellFolder2) file2);

which sends us here, to Win32ShellFolderManager2.compareShellFolders(). In that function is the following code:

// Non-file shellfolders sort before files
if (special1 && !special2) {
    return -1;
} else if (special2 && !special1) {
    return  1;
}

What this does is make every special item sort before every non-special item. (Ignore the commentā€”itā€™s wrong. It should say ā€œSpecialā€ instead of ā€œNon-fileā€, because itā€™s possible to be both special and a real file. a is just such a thing.)

So, thatā€™s the problem: compareTo sorts specials ahead of non-specials, but equals never checks whether anything is special, which causes them to disagree.

I now have enough information to file a bug report with OpenJDK explaining exactly what is wrong; hopefully they will act on it and fix the problem. (It might be as simple as a one-line change to equals().) This is a problem weā€™ve seen occasionally for many years and until now we could never pinpoint the cause. Please accept my sincere thanks for running all the diagnostic programs so I could find the bug.

Whatā€™s next? It might take a while for a fix to appear in a Java release. In the meantime, there are a few avenues I can pursue for working around the bug. I will start working on those shortly, and get back to you with something to test as soon as I have it.

2 Likes

Hereā€™s a bit more detail about what in the code is incorrect. The bug is very subtle, in that it involves Win32ShellFolder2.equals() being called indirectly.

This code is from Win32ShellFolderManager2.compareShellFolders():

        if (special1 || special2) {
            if (topFolderList == null) {
                ArrayList<Win32ShellFolder2> tmpTopFolderList = new ArrayList<>();
                tmpTopFolderList.add(Win32ShellFolderManager2.getPersonal());
                tmpTopFolderList.add(Win32ShellFolderManager2.getDesktop());
                tmpTopFolderList.add(Win32ShellFolderManager2.getDrives());
                tmpTopFolderList.add(Win32ShellFolderManager2.getNetwork());
                topFolderList = tmpTopFolderList;
            }
            int i1 = topFolderList.indexOf(sf1);
            int i2 = topFolderList.indexOf(sf2);
            if (i1 >= 0 && i2 >= 0) {
                return (i1 - i2);
            } else if (i1 >= 0) {
                return -1;
            } else if (i2 >= 0) {
                return 1;
            }
        }

The idea here is that there are four ā€œwell-knownā€ specials which are more special than all the others and should be sorted in a particular order ahead of them. The special folder returned by getPersonal() is C:\Users\duduy\Documents, and is at index 0 of topFolderList. When comparing a and b (which are both C:\Users\duduy\Documents, but a.isSpecial() is true while b.isSpecial() is not), we enter this block of code because at least one of a, b is special. We call topFolderList.indexOf(a) and find that a is at index 0 in topFolderList. Then we call topFolderList.indexOf(b)ā€”and this is where everything goes to hell. What we get from topFolderList.indexOf(b) is also 0.

Why is that? Itā€™s because ArrayList.indexOf() calls equals() to determine if the argument itā€™s given is at the index itā€™s checking, but Win32ShellFolder2.equals() _does not check isSpecial(). So, having found both a and b at index 0, the function returns 0 - 0, which is 0, and thus a.compareTo(b) == 0.

There is a trivial fix for the problem. The line

if (special1 || special2) {

should be

if (special1 && special2) {

instead.

There is no point in entering this entire block of code at all if one of the folders being compared is not specialā€”if one is special and the other isnā€™t, the block of code immediately following already handles that:

if (special1 && !special2) {
    return -1;
} else if (special2 && !special1) {
   return  1;
}

Iā€™ve now submitted a bug report to OpenJDK, which was assigned ā€œinternal review ID 9075014ā€. Weā€™ll see if anything comes of that.

Incidentally, this bug report from 2015 is exactly the problem weā€™re having, but nobody collected enough data then to determine the cause; and these guys are having the same problem, more recently.

You are welcome, and also, thank for you effort.

Then, I suppose that the problem will be solved in a future update. However, for an immediate action for avoiding the bug, I have to remove the second (or the first) instance of the path C:\Users\duduy\Documents. But I donā€™t know what this instance is.

I donā€™t know that thereā€™s any way you can remove it.

Iā€™ve attempted one of the possible workarounds. Please try this build. Does the file dialog work for you with this?

YES!!!

The build works fine, so the file dialog opens.

Thank you!.

1 Like

Great! Iā€™m glad it works.

The workaround will be in the 3.7.0-beta2 release. Hopefully weā€™ll see a release of Java with a proper fix, so we can remove the workaround.

Iā€™ll come back when I have time to describe what the workaround is, because itā€™s one of the most gnarly Iā€™ve ever done in Java.

2 Likes

Hereā€™s the bug report: JDK-8305072.

Hereā€™s the workaround.

What itā€™s doing is using the Java agent interface and ByteBuddy to redefine the Win32ShellFolderManager2 class before it gets loaded by the JVM Vassal runs in. Our redefined class intercepts calls to Win32ShellFolderManager2.compareShellFolders(), checking whether the arguments are the kind which trigger the bug, and then rewriting the result in the case where they do.

1 Like

Weā€™ve finally had some movement from the JDK developers to look into the problem. Thereā€™s a PR on GitHub for the fix I suggested, so we may see it in a JDK release soon.

@mcdudu78, the JDK dev working on the ticket asked if you can still reproduce the problem. Can you?