RFR: 8375227: Silent OOBE in NGGroup::renderContent [v2]

Kevin Rushforth kcr at openjdk.org
Wed Jan 14 22:43:02 UTC 2026


On Wed, 14 Jan 2026 22:04:15 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

> I'm not sure this is equivalent. Also, I'd like to see a test for this. In general, adding null checks or other similar checks without understanding them is not something we want to do.

To add a little more to this, replacing code like this:


    try {
        // do something
    } catch (NullPointerException npe) {
       // log or ignore or ...
    }


with something like this:


    if (check for null) {
       // log or ignore or ...
    } else {
        // do something
    }


is generally fine and usually easy to prove equivalence.

Unless I'm missing something, this PR doesn't do that, rather it takes a state -- startPos == -1 -- that currently causes an OOBE (which is silently ignored) and clamps the value so it will actually do something. That's not equivalent, at least not in all cases.

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

PR Comment: https://git.openjdk.org/jfx/pull/2037#issuecomment-3752024225


More information about the openjfx-dev mailing list