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

Michael Strauß mstrauss at openjdk.org
Thu Jan 15 14:23:21 UTC 2026


On Thu, 15 Jan 2026 01:57:41 GMT, Christopher Schnick <duke at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/javafx/sg/prism/NGGroup.java line 259:
>> 
>>> 257:                 NGNode child;
>>> 258:                 try {
>>> 259:                     child = orderedChildren.get(i);
>> 
>> You should remove the try-catch block as your change ensures that `List.get()` is never called with an invalid index.
>
> Judging from the comment below, the catch block was mainly meant to handle concurrent modifications of the list. That scenario might still happen

It does say that, but I don't believe it to be necessary or effective. First of all, there should be no concurrent modifications. The rest of this class assumes this to be true, as `getOrderedChildren()` is iterated over in six other places in the same class, all without wrapping the getter in a try-catch block. Second, you've removed the only scenario where the getter is called with an objectively wrong index (-1), and actually throws an exception.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2037#discussion_r2694566221


More information about the openjfx-dev mailing list