On Tue, 15 Nov 2022 15:39:24 GMT, Alexey Ivanov <[email protected]> wrote:

> > Yeah, the only way the retVal can become null would-be if 
> > `resolutionVariants` doesn't have an Icon. I could not reproduce the bug 
> > since it is intermittent, I came to this conclusion only by code analysis 
> > though. Should I check for `resolutionVariants` if its empty and return 
> > null without proceeding further......? I guess both the ways `null` will be 
> > returned?
> 
> An MRI that has no images does not make any sense, we should've returned null.
> 
> There are two usages of the constructor which accepts resolution variants:
> 
> https://github.com/openjdk/jdk/blob/6c8d0e617ff59eee1313589b10edbf5830774db5/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java#L1185
> 
> 
> https://github.com/openjdk/jdk/blob/6c8d0e617ff59eee1313589b10edbf5830774db5/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java#L1112-L1113
> 
> There are four usages of the other constructor which accepts an image.
> 
> Since it's an intermittent problem, we need to add debugging code to the code 
> which creates the `MultiResolutionIconImage` object or handle the exceptional 
> cases in the constructor… by adding an `assert` statement. The tests are run 
> with asserts enabled and we may get more data.
> 
> Is there a host where the test is more likely to fail? Does it fail on 
> different hosts?
> 
> Adding the null check to `getResolutionVariant` does not fix the root cause. 
> Instead, it'll make it impossible to find the root cause because everything 
> would look as if no problem exists.

Yeah, agree to your point that it actually mask the actual problem. It fails 
only when windows L&F is used and `JFileChooser` is instantiated. On creating 
file chooser instance on windows `getSystemIcon` is called initiates the 
problem.

-------------

PR: https://git.openjdk.org/jdk/pull/11104

Reply via email to