Null pointer checks in event handler / filter registration methods

Lubomir Nerad lubomir.nerad at
Fri Jan 13 07:12:01 PST 2012


I am working on (Adding 
null event handlers is allowed - later leads to NPE). To fix it I want 
to add null checks (with NPE throws) for event type and event handler or 
filter to the addEventHandler, removeEventHandler, addEventFilter and 
removeEventFilter methods of Node, Scene, Window, Task, Service, 
MenuItem, TableColumn and TreeItem. Passing null event type or event 
handler / filter to these methods clearly indicates programmer's error 
and so should be reported early. Failure to do that may result in an 
exception later in program execution which cause is then hard to guess.

I don't know whether this change requires an explicit approval, but 
previously javadoc for these methods didn't specify possible NPE and so 
the API behavior will change in this respect.


More information about the openjfx-dev mailing list