RFR: 8139228: JFileChooser renders file names as HTML document
Tejesh R
tr at openjdk.org
Mon Apr 28 12:51:50 UTC 2025
On Wed, 23 Apr 2025 11:23:05 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> When we are unable to create a folder with special characters in windows OS, why do we need to test it using custom `FileSystemView` ? My point is will any developer do this in windows?
>
> Because the problem is still there, and there are virtual folders on Windows. If a custom `FileSystemView` can return file names with `"<html>"` in their name, `JFileChooser` in Windows Look and Feel will render the file name as HTML.
>
> Isn't it the problem that you're trying to fix?
@aivanov-jdk @mrserb I tried with virtual file system, using custom FileSystemView. On windows and windowsCalssic L&F, the JFileChooser doesn't show up, rather throws and exception which I mentioned below.
Exception in thread "AWT-EventQueue-0" java.nio.file.InvalidPathException: Illegal char <<> at index 0: <html><h1 color=#ff00ff><font face="Comic Sans MS">SWING ROCKS!!!111
at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:191)
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:142)
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:46)
at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:203)
at java.base/java.nio.file.Path.of(Path.java:148)
at java.base/java.nio.file.Paths.get(Paths.java:69)
at java.desktop/sun.awt.shell.ShellFolder.getShellFolder(ShellFolder.java:260)
at java.desktop/javax.swing.filechooser.FileSystemView.getShellFolder(FileSystemView.java:724)
at java.desktop/javax.swing.filechooser.FileSystemView.getSystemIcon(FileSystemView.java:242)
at java.desktop/com.sun.java.swing.plaf.windows.WindowsFileChooserUI$WindowsFileView.getIcon(WindowsFileChooserUI.java:1398)
at java.desktop/javax.swing.JFileChooser.getIcon(JFileChooser.java:1614)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24439#discussion_r2063587671
More information about the client-libs-dev
mailing list