.equals() should check for null 58/10258/1
authorRobert Varga <rovarga@cisco.com>
Mon, 25 Aug 2014 20:04:11 +0000 (22:04 +0200)
committerRobert Varga <rovarga@cisco.com>
Mon, 25 Aug 2014 20:04:11 +0000 (22:04 +0200)
This fixes a sonar warning.

Change-Id: Ia33f58ffa0668d1eae811b9dc9d2848a7c7ec96e
Signed-off-by: Robert Varga <rovarga@cisco.com>
common/util/src/main/java/org/opendaylight/yangtools/util/concurrent/QueuedNotificationManager.java

index 472520d998b260e8cc2b80401df2ebbd8d2f6a53..a939840d6255497b47a9356d5f8b133b52c61290 100644 (file)
@@ -208,6 +208,13 @@ public class QueuedNotificationManager<L,N> implements NotificationManager<L,N>
 
         @Override
         public boolean equals( Object obj ) {
+            if (obj == this) {
+                return true;
+            }
+            if (!(obj instanceof ListenerKey<?>)) {
+                return false;
+            }
+
             ListenerKey<?> other = (ListenerKey<?>) obj;
             return listener == other.listener;
         }