RFR: 6521141: DebugGraphics NPE @ setFont(); [v4]

Tejesh R tr at openjdk.org
Fri Jul 29 05:16:54 UTC 2022


On Thu, 28 Jul 2022 18:08:31 GMT, Tejesh R <tr at openjdk.org> wrote:

>> `DebugGraphics` class has a Graphics instance which is been used in slowed down drawing. The `graphics` object is not initialized anywhere inside the class, where it is expected to set explicitly by the user. When the user doesn't set it and try to use the any mehtods like `drawing/setFont`, NPE is raised which is expected. The scenario is taken care by checking if the `graphics` object is null before using it inside the class, thus eliminating the NPE case.
>
> Tejesh R has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Removed whitespace error

> 

Yeah, this looks like a better idea @prrace. I will update the java doc and also will create the BufferedImage graphics from the no-arg constructor. With this we will be warning about the usage of no-arg constructor to user and also handle NPE cases.

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

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



More information about the client-libs-dev mailing list