Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 243874 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/rwt/internal/events/EventAdapter.java (-4 / +13 lines)
Lines 13-18 Link Here
13
import java.util.*;
13
import java.util.*;
14
14
15
import org.eclipse.rwt.internal.util.ParamCheck;
15
import org.eclipse.rwt.internal.util.ParamCheck;
16
import org.eclipse.swt.SWT;
16
17
17
public class EventAdapter implements IEventAdapter {
18
public class EventAdapter implements IEventAdapter {
18
19
Lines 108-115 Link Here
108
  public void addListener( final Class listenerType, 
109
  public void addListener( final Class listenerType, 
109
                           final Object listener ) 
110
                           final Object listener ) 
110
  {
111
  {
111
    ParamCheck.notNull( listenerType, "listenerType" );
112
    if( listenerType == null ) {
112
    ParamCheck.notNull( listener, "listener" );
113
      SWT.error( SWT.ERROR_NULL_ARGUMENT );
114
    }
115
    if( listener == null ) {
116
      SWT.error( SWT.ERROR_NULL_ARGUMENT );
117
    }
113
    checkTypeCompatibility( listenerType, listener );
118
    checkTypeCompatibility( listenerType, listener );
114
    getListenerSet( listenerType ).add( listener );
119
    getListenerSet( listenerType ).add( listener );
115
  }
120
  }
Lines 117-124 Link Here
117
  public void removeListener( final Class listenerType, 
122
  public void removeListener( final Class listenerType, 
118
                              final Object listener )
123
                              final Object listener )
119
  {
124
  {
120
    ParamCheck.notNull( listenerType, "listenerType" );
125
    if( listenerType == null ) {
121
    ParamCheck.notNull( listener, "listener" );
126
      SWT.error( SWT.ERROR_NULL_ARGUMENT );
127
    }
128
    if( listener == null ) {
129
      SWT.error( SWT.ERROR_NULL_ARGUMENT );
130
    }
122
    checkTypeCompatibility( listenerType, listener );
131
    checkTypeCompatibility( listenerType, listener );
123
    if( hasListener( listenerType ) ) {
132
    if( hasListener( listenerType ) ) {
124
      getListenerSet( listenerType ).remove( listener );
133
      getListenerSet( listenerType ).remove( listener );
(-)src/org/eclipse/rwt/internal/events/EventAdapter_Test.java (+10 lines)
Lines 67-72 Link Here
67
      fail();
67
      fail();
68
    } catch( final IllegalArgumentException iae ) {
68
    } catch( final IllegalArgumentException iae ) {
69
    }
69
    }
70
    try {
71
      eventAdapter.addListener( SelectionListener.class, null );
72
      fail();
73
    } catch( final IllegalArgumentException iae ) {
74
    }
75
    try {
76
      eventAdapter.addListener( null, new Object() );
77
      fail();
78
    } catch( final IllegalArgumentException iae ) {
79
    }
70
    listener = eventAdapter.getListener( SelectionListener.class );
80
    listener = eventAdapter.getListener( SelectionListener.class );
71
    assertEquals( 0, listener.length );
81
    assertEquals( 0, listener.length );
72
  }
82
  }
(-)src/org/eclipse/swt/custom/CCombo_Test.java (-4 / +4 lines)
Lines 381-387 Link Here
381
    try {
381
    try {
382
      combo.addModifyListener( null );
382
      combo.addModifyListener( null );
383
      fail( "removeModifyListener must not allow null listener" );
383
      fail( "removeModifyListener must not allow null listener" );
384
    } catch( NullPointerException e ) {
384
    } catch( IllegalArgumentException e ) {
385
      // expected
385
      // expected
386
    }
386
    }
387
    // test whether all content modifying API methods send a Modify event
387
    // test whether all content modifying API methods send a Modify event
Lines 431-437 Link Here
431
    try {
431
    try {
432
      combo.removeModifyListener( null );
432
      combo.removeModifyListener( null );
433
      fail( "removeModifyListener must not allow null listener" );
433
      fail( "removeModifyListener must not allow null listener" );
434
    } catch( NullPointerException e ) {
434
    } catch( IllegalArgumentException e ) {
435
      // expected
435
      // expected
436
    }
436
    }
437
  }
437
  }
Lines 450-456 Link Here
450
    try {
450
    try {
451
      combo.addModifyListener( null );
451
      combo.addModifyListener( null );
452
      fail( "removeModifyListener must not allow null listener" );
452
      fail( "removeModifyListener must not allow null listener" );
453
    } catch( NullPointerException e ) {
453
    } catch( IllegalArgumentException e ) {
454
      // expected
454
      // expected
455
    }
455
    }
456
    // test whether all content modifying API methods send a Modify event
456
    // test whether all content modifying API methods send a Modify event
Lines 497-503 Link Here
497
    try {
497
    try {
498
      combo.removeModifyListener( null );
498
      combo.removeModifyListener( null );
499
      fail( "removeModifyListener must not allow null listener" );
499
      fail( "removeModifyListener must not allow null listener" );
500
    } catch( NullPointerException e ) {
500
    } catch( IllegalArgumentException e ) {
501
      // expected
501
      // expected
502
    }
502
    }
503
  }
503
  }
(-)src/org/eclipse/swt/widgets/Combo_Test.java (-4 / +4 lines)
Lines 359-365 Link Here
359
    try {
359
    try {
360
      combo.addModifyListener( null );
360
      combo.addModifyListener( null );
361
      fail( "removeModifyListener must not allow null listener" );
361
      fail( "removeModifyListener must not allow null listener" );
362
    } catch( NullPointerException e ) {
362
    } catch( IllegalArgumentException e ) {
363
      // expected
363
      // expected
364
    }
364
    }
365
    // test whether all content modifying API methods send a Modify event
365
    // test whether all content modifying API methods send a Modify event
Lines 409-415 Link Here
409
    try {
409
    try {
410
      combo.removeModifyListener( null );
410
      combo.removeModifyListener( null );
411
      fail( "removeModifyListener must not allow null listener" );
411
      fail( "removeModifyListener must not allow null listener" );
412
    } catch( NullPointerException e ) {
412
    } catch( IllegalArgumentException e ) {
413
      // expected
413
      // expected
414
    }
414
    }
415
  }
415
  }
Lines 428-434 Link Here
428
    try {
428
    try {
429
      combo.addModifyListener( null );
429
      combo.addModifyListener( null );
430
      fail( "removeModifyListener must not allow null listener" );
430
      fail( "removeModifyListener must not allow null listener" );
431
    } catch( NullPointerException e ) {
431
    } catch( IllegalArgumentException e ) {
432
      // expected
432
      // expected
433
    }
433
    }
434
    // test whether all content modifying API methods send a Modify event
434
    // test whether all content modifying API methods send a Modify event
Lines 475-481 Link Here
475
    try {
475
    try {
476
      combo.removeModifyListener( null );
476
      combo.removeModifyListener( null );
477
      fail( "removeModifyListener must not allow null listener" );
477
      fail( "removeModifyListener must not allow null listener" );
478
    } catch( NullPointerException e ) {
478
    } catch( IllegalArgumentException e ) {
479
      // expected
479
      // expected
480
    }
480
    }
481
  }
481
  }

Return to bug 243874