<Swing Dev> [jdk17] RFR: 8269269: [macos11] SystemIconTest fails with ClassCastException
Alexander Zuev
kizune at openjdk.java.net
Wed Jun 30 19:22:07 UTC 2021
On Wed, 30 Jun 2021 04:51:04 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>>> * but what happens if the file cannot be read? We will call the "sf = ShellFolder.getShellFolder" and then we call "sf.getIcon()" and it returns what? As far as I understand it always return MultiResolutionIconImage, no?
>>> *
>>
>> No, the native code will fail to load the icon but since file does exist and we only return null for nonexistent file we will fall back to UIManager.getIcon which returns icon from the installed LAF resource bundle. This is correct behavior since otherwise we might end in file manager with file that has no icon at all. Right now that will be a single resolution icon for all the LAFs. Again, in the future that can be changed but right now it is a single resolution icon.
>
>> No, the native code will fail to load the icon
> So what call will fail? Is the "sf.getIcon()" return null? in what line of code?
Yes, from my remote debugging it happens in sf.getIcon() but the circumstances are quite rare - file has to be inaccessible and the user's GUI session should not be initialized - that's why this failure only happens on headless testing. Another solution would be to mark this test as headful - that would solve issue as well.
-------------
PR: https://git.openjdk.java.net/jdk17/pull/178
More information about the swing-dev
mailing list