RFR: 6429812: NPE after calling JTable.updateUI() when using a header renderer + XP L&F [v5]

Alexey Ivanov aivanov at openjdk.java.net
Fri Jun 3 15:24:37 UTC 2022


On Fri, 3 Jun 2022 05:42:38 GMT, Tejesh R <tr at openjdk.org> wrote:

> I see that the bug description has a test case which produce this exception. There are these lines on the stack:
> 
> ```
> 	at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:116)
> 	at java.awt.Container.paint(Container.java:1978)
> 	at java.awt.Window.paint(Window.java:3906)
> ```
> 
> So your automatic test may override the paint method and catch an exception there. The main method will check some flags at the end.

@TejeshR13's latest version installs `UncaughtExceptionHandler` to see whether any exception occurs on EDT.

> Can we iterate all installed L&F? It seems the test does not have any windows specific code.

It's Windows-specific because NPE is thrown on Windows only. However, testing other L&Fs makes sense to ensure it doesn't happen there either.

 
> I think that the rendering to the BufferedImage as suggested by @aivanov-jdk should work as well.

In theory only. I was unable to make the table paint with its header to `BufferedImage`. The component isn't laid out until it's added to peered top-level. If you know how to make it paint as if in the frame, I'd welcome it. At this point, painting to `BufferedImage` doesn't reproduce the NPE.

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

PR: https://git.openjdk.java.net/jdk/pull/8830



More information about the client-libs-dev mailing list