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

Phil Race prr at openjdk.org
Thu Aug 4 20:38:34 UTC 2022


On Tue, 2 Aug 2022 06:51:36 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:
> 
>   Updated based on review comments

Changes requested by prr (Reviewer).

src/java.desktop/share/classes/javax/swing/DebugGraphics.java line 79:

> 77:      * <p>
> 78:      * NOTE: This constructor should not be called by
> 79:      * application, it is for Internal use only. When called directly

"application" -> "applications"
"Internal" -> "internal"

test/jdk/javax/swing/DebugGraphics/DebugGraphicsNPETest.java line 30:

> 28: /* @test
> 29:  * @bug 6521141
> 30:  * @key headful

Why does this test need to be headful ?

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

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



More information about the client-libs-dev mailing list