changeset 245:a75035c2f8cc

Fix for RT-18865: added null checks to event handler / filter registration / unregistration methods
author Lubomir Nerad <lubomir.nerad@oracle.com>
date Mon, 16 Jan 2012 12:42:51 +0100
parents 7572020a30ad
children 2fc581846b26
files javafx-concurrent/src/javafx/concurrent/Service.java javafx-concurrent/src/javafx/concurrent/Task.java javafx-ui-controls/src/javafx/scene/control/MenuItem.java javafx-ui-controls/src/javafx/scene/control/TableColumn.java javafx-ui-controls/src/javafx/scene/control/TreeItem.java javafx-ui-controls/test/javafx/scene/control/MenuItemTest.java javafx-ui-controls/test/javafx/scene/control/MenuTest.java
diffstat 7 files changed, 16 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-concurrent/src/javafx/concurrent/Service.java	Fri Jan 13 14:47:09 2012 -0800
+++ b/javafx-concurrent/src/javafx/concurrent/Service.java	Mon Jan 16 12:42:51 2012 +0100
@@ -608,6 +608,7 @@
      * @param <T> the specific event class of the handler
      * @param eventType the type of the events to receive by the handler
      * @param eventHandler the handler to register
+     * @throws NullPointerException if the event type or handler is null
      */
     public final <T extends Event> void addEventHandler(
             final EventType<T> eventType,
@@ -624,6 +625,7 @@
      * @param <T> the specific event class of the handler
      * @param eventType the event type from which to unregister
      * @param eventHandler the handler to unregister
+     * @throws NullPointerException if the event type or handler is null
      */
     public final <T extends Event> void removeEventHandler(
             final EventType<T> eventType,
@@ -638,6 +640,7 @@
      * @param <T> the specific event class of the filter
      * @param eventType the type of the events to receive by the filter
      * @param eventFilter the filter to register
+     * @throws NullPointerException if the event type or filter is null
      */
     public final <T extends Event> void addEventFilter(
             final EventType<T> eventType,
@@ -654,6 +657,7 @@
      * @param <T> the specific event class of the filter
      * @param eventType the event type from which to unregister
      * @param eventFilter the filter to unregister
+     * @throws NullPointerException if the event type or filter is null
      */
     public final <T extends Event> void removeEventFilter(
             final EventType<T> eventType,
@@ -670,6 +674,7 @@
      * @param <T> the specific event class of the handler
      * @param eventType the event type to associate with the given eventHandler
      * @param eventHandler the handler to register, or null to unregister
+     * @throws NullPointerException if the event type is null
      */
     protected final <T extends Event> void setEventHandler(
             final EventType<T> eventType,
--- a/javafx-concurrent/src/javafx/concurrent/Task.java	Fri Jan 13 14:47:09 2012 -0800
+++ b/javafx-concurrent/src/javafx/concurrent/Task.java	Mon Jan 16 12:42:51 2012 +0100
@@ -1082,6 +1082,7 @@
      * @param <T> the specific event class of the handler
      * @param eventType the type of the events to receive by the handler
      * @param eventHandler the handler to register
+     * @throws NullPointerException if the event type or handler is null
      */
     public final <T extends Event> void addEventHandler(
             final EventType<T> eventType,
@@ -1098,6 +1099,7 @@
      * @param <T> the specific event class of the handler
      * @param eventType the event type from which to unregister
      * @param eventHandler the handler to unregister
+     * @throws NullPointerException if the event type or handler is null
      */
     public final <T extends Event> void removeEventHandler(
             final EventType<T> eventType,
@@ -1112,6 +1114,7 @@
      * @param <T> the specific event class of the filter
      * @param eventType the type of the events to receive by the filter
      * @param eventFilter the filter to register
+     * @throws NullPointerException if the event type or filter is null
      */
     public final <T extends Event> void addEventFilter(
             final EventType<T> eventType,
@@ -1128,6 +1131,7 @@
      * @param <T> the specific event class of the filter
      * @param eventType the event type from which to unregister
      * @param eventFilter the filter to unregister
+     * @throws NullPointerException if the event type or filter is null
      */
     public final <T extends Event> void removeEventFilter(
             final EventType<T> eventType,
@@ -1144,6 +1148,7 @@
      * @param <T> the specific event class of the handler
      * @param eventType the event type to associate with the given eventHandler
      * @param eventHandler the handler to register, or null to unregister
+     * @throws NullPointerException if the event type is null
      */
     protected final <T extends Event> void setEventHandler(
             final EventType<T> eventType,
--- a/javafx-ui-controls/src/javafx/scene/control/MenuItem.java	Fri Jan 13 14:47:09 2012 -0800
+++ b/javafx-ui-controls/src/javafx/scene/control/MenuItem.java	Mon Jan 16 12:42:51 2012 +0100
@@ -395,6 +395,7 @@
      * @param <E> the specific event class of the handler
      * @param eventType the type of the events to receive by the handler
      * @param eventHandler the handler to register
+     * @throws NullPointerException if the event type or handler is null
      */
     public <E extends Event> void addEventHandler(EventType<E> eventType, EventHandler<E> eventHandler) {
         eventHandlerManager.addEventHandler(eventType, eventHandler);
@@ -409,6 +410,7 @@
      * @param <E> the specific event class of the handler
      * @param eventType the event type from which to unregister
      * @param eventHandler the handler to unregister
+     * @throws NullPointerException if the event type or handler is null
      */
     public <E extends Event> void removeEventHandler(EventType<E> eventType, EventHandler<E> eventHandler) {
         eventHandlerManager.removeEventHandler(eventType, eventHandler);
--- a/javafx-ui-controls/src/javafx/scene/control/TableColumn.java	Fri Jan 13 14:47:09 2012 -0800
+++ b/javafx-ui-controls/src/javafx/scene/control/TableColumn.java	Mon Jan 16 12:42:51 2012 +0100
@@ -1001,6 +1001,7 @@
      *
      * @param eventType the type of the events to receive by the handler
      * @param eventHandler the handler to register
+     * @throws NullPointerException if the event type or handler is null
      */
     public <E extends Event> void addEventHandler(EventType<E> eventType, EventHandler<E> eventHandler) {
         eventHandlerManager.addEventHandler(eventType, eventHandler);
@@ -1014,6 +1015,7 @@
      *
      * @param eventType the event type from which to unregister
      * @param eventHandler the handler to unregister
+     * @throws NullPointerException if the event type or handler is null
      */
     public <E extends Event> void removeEventHandler(EventType<E> eventType, EventHandler<E> eventHandler) {
         eventHandlerManager.removeEventHandler(eventType, eventHandler);
--- a/javafx-ui-controls/src/javafx/scene/control/TreeItem.java	Fri Jan 13 14:47:09 2012 -0800
+++ b/javafx-ui-controls/src/javafx/scene/control/TreeItem.java	Mon Jan 16 12:42:51 2012 +0100
@@ -794,6 +794,7 @@
      *
      * @param eventType the type of the events to receive by the handler
      * @param eventHandler the handler to register
+     * @throws NullPointerException if the event type or handler is null
      */
     public <E extends Event> void addEventHandler(EventType<E> eventType, EventHandler<E> eventHandler) {
         eventHandlerManager.addEventHandler(eventType, eventHandler);
@@ -807,6 +808,7 @@
      *
      * @param eventType the event type from which to unregister
      * @param eventHandler the handler to unregister
+     * @throws NullPointerException if the event type or handler is null
      */
     public <E extends Event> void removeEventHandler(EventType<E> eventType, EventHandler<E> eventHandler) {
         eventHandlerManager.removeEventHandler(eventType, eventHandler);
--- a/javafx-ui-controls/test/javafx/scene/control/MenuItemTest.java	Fri Jan 13 14:47:09 2012 -0800
+++ b/javafx-ui-controls/test/javafx/scene/control/MenuItemTest.java	Mon Jan 16 12:42:51 2012 +0100
@@ -465,10 +465,6 @@
         assertTrue(menuItem.getStyleClass().size() == 0);
     }
 
-    @Test public void addedEventHandlerWithTwoNullArgs() {
-        menuItem.addEventHandler(null, null); // should throw no exceptions, if it does, the test fails
-    }
-
     @Test public void addedEventHandler1() {
         EventType<Event> et1 = new EventType<Event>(Event.ANY, "ON_EVENT");
         NewEventHandlerStub handler = new NewEventHandlerStub();
@@ -487,10 +483,6 @@
         assertTrue(handler.called);
     }
 
-    @Test public void removedEventHandlerWithTwoNullArgs() {
-        menuItem.addEventHandler(null, null); // should throw no exceptions, if it does, the test fails
-    }
-
     @Test public void addedRemovedEventHandler1() {
         EventType<Event> et1 = new EventType<Event>(Event.ANY, "ON_EVENT");
         NewEventHandlerStub handler = new NewEventHandlerStub();
--- a/javafx-ui-controls/test/javafx/scene/control/MenuTest.java	Fri Jan 13 14:47:09 2012 -0800
+++ b/javafx-ui-controls/test/javafx/scene/control/MenuTest.java	Mon Jan 16 12:42:51 2012 +0100
@@ -527,10 +527,6 @@
         assertFalse(hidingOccured2);
     }
 
-    @Test public void addedEventHandlerWithTwoNullArgs() {
-        menu.addEventHandler(null, null); // should throw no exceptions, if it does, the test fails
-    }
-
     @Test public void addedEventHandler1() {
         EventType<Event> et1 = new EventType<Event>(Event.ANY, "ON_EVENT");
         EventHandlerStub handler = new EventHandlerStub();
@@ -549,10 +545,6 @@
         assertTrue(handler.called);
     }
 
-    @Test public void removedEventHandlerWithTwoNullArgs() {
-        menu.addEventHandler(null, null); // should throw no exceptions, if it does, the test fails
-    }
-
     @Test public void addedRemovedEventHandler1() {
         EventType<Event> et1 = new EventType<Event>(Event.ANY, "ON_EVENT");
         EventHandlerStub handler = new EventHandlerStub();