JDK-8299893 : Folder icon cannot be fetched from Windows on a headless system
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 20
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows
  • CPU: x86_64
  • Submitted: 2023-01-10
  • Updated: 2023-01-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 21
21Unresolved
Description
ADESCRIPTION OF THE PROBLEM:
Folder Icons failed to load when JFileChooser instance is created on headless system. This issue is observed as part of JDK-8293862 and JDK-8227257 test. The issue seems intermittent as this was reproduced and found that the failure is observed for random folders for Image Icon loading.
The following error is shown when an assertion is added for Image Icon load failure for testing purpose.

----------System.err:(27/1933)*----------
java.lang.reflect.InvocationTargetException
	at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1371)
	at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1346)
	at java.desktop/javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1480)
	at bug8046391.main(bug8046391.java:52)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:125)
	at java.base/java.lang.Thread.run(Thread.java:1591)
Caused by: java.lang.AssertionError: C:\\Users\\mach5-one\\Downloads doesn't have icon(newIcon)
	at java.desktop/sun.awt.shell.Win32ShellFolder2.lambda$getIcon$0(Win32ShellFolder2.java:1178)
	at java.desktop/sun.awt.shell.Win32ShellFolderManager2$ComInvoker.invoke(Win32ShellFolderManager2.java:626)
	at java.desktop/sun.awt.shell.ShellFolder.invoke(ShellFolder.java:532)
	at java.desktop/sun.awt.shell.ShellFolder.invoke(ShellFolder.java:518)
	at java.desktop/sun.awt.shell.Win32ShellFolder2.getIcon(Win32ShellFolder2.java:1138)
	at java.desktop/sun.awt.shell.Win32ShellFolder2$15.call(Win32ShellFolder2.java:1120)
	at java.desktop/sun.awt.shell.Win32ShellFolder2$15.call(Win32ShellFolder2.java:1059)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.desktop/sun.awt.shell.Win32ShellFolderManager2$ComInvoker$1.run(Win32ShellFolderManager2.java:595)