[Rev 02] RFR: 8244418: MenuBar: IOOB exception on requestFocus on empty bar
Jeanette Winzenburg
fastegal at openjdk.java.net
Mon May 18 09:54:05 UTC 2020
On Mon, 18 May 2020 05:42:17 GMT, Ajit Ghaisas <aghaisas at openjdk.org> wrote:
>> hmm .. yeah I'm aware of getContainer vs. getMenus - but they should be the same size, shouldn't they?
>>
>> Anyway, if focusedIndex != getMenus().indexOf all users of focusedIndex have to include a check for validity. That
>> might be prevented by not allowing it here in the method, in setting its value not unconditionally to the given index
>> but guard it against being valid:
>> focusedMenuIndex = index >= getMenus().size() ? -1 : index
>>
>> Then focused is either valid or -1.
>
> Good suggestion on not setting the foucusedMenuIndex unconditionally.
> Also, we need to check for index < -1 : just to tighten up this method.
> I have added this check.
glad we came to an agreement at last :)
-------------
PR: https://git.openjdk.java.net/jfx/pull/216
More information about the openjfx-dev
mailing list