diff --git a/apps/config/src/main/java/org/onosproject/config/ResourceIdParser.java b/apps/config/src/main/java/org/onosproject/config/ResourceIdParser.java
index 50e807a..0e32fe5 100644
--- a/apps/config/src/main/java/org/onosproject/config/ResourceIdParser.java
+++ b/apps/config/src/main/java/org/onosproject/config/ResourceIdParser.java
@@ -80,12 +80,7 @@
 
     public static NodeKey getInstanceKey(ResourceId path) {
         int last = path.nodeKeys().size();
-        NodeKey ret = path.nodeKeys().get(last - 1);
-        if (ret instanceof NodeKey) {
-            return ret;
-        } else {
-            return null;
-        }
+        return path.nodeKeys().get(last - 1);
     }
 
     public static NodeKey getMultiInstanceKey(ResourceId path) {
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/manager/impl/EvpnManager.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/manager/impl/EvpnManager.java
index 562171b..7a87fd5 100644
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/manager/impl/EvpnManager.java
+++ b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/manager/impl/EvpnManager.java
@@ -807,15 +807,16 @@
 
         @Override
         public void event(EvpnRouteEvent event) {
-            if (!(event.subject() instanceof EvpnRoute)) {
+            if (event.subject() != null) {
+                EvpnRoute route = (EvpnRoute) event.subject();
+                if (EvpnRouteEvent.Type.ROUTE_ADDED == event.type()) {
+                    onBgpEvpnRouteUpdate(route);
+                } else if (EvpnRouteEvent.Type.ROUTE_REMOVED == event.type()) {
+                    onBgpEvpnRouteDelete(route);
+                }
+            } else {
                 return;
             }
-            EvpnRoute route = (EvpnRoute) event.subject();
-            if (EvpnRouteEvent.Type.ROUTE_ADDED == event.type()) {
-                onBgpEvpnRouteUpdate(route);
-            } else if (EvpnRouteEvent.Type.ROUTE_REMOVED == event.type()) {
-                onBgpEvpnRouteDelete(route);
-            }
         }
     }
 
diff --git a/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/ConnectPointProtoTranslator.java b/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/ConnectPointProtoTranslator.java
index 6620096..fd149b1 100644
--- a/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/ConnectPointProtoTranslator.java
+++ b/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/ConnectPointProtoTranslator.java
@@ -75,7 +75,7 @@
             return ConnectPointProto.newBuilder().setHostId(connectPoint.hostId().toString())
                     .setPortNumber(connectPoint.port().toString())
                     .build();
-        } else if (connectPoint.ipElementId() instanceof IpElementId) {
+        } else if (connectPoint.ipElementId() != null) {
             return ConnectPointProto.newBuilder().setIpElementId(connectPoint.ipElementId().toString())
                     .setPortNumber(connectPoint.port().toString())
                     .build();
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/WideCommunityInteger.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/WideCommunityInteger.java
index 745a831..cabe74d 100644
--- a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/WideCommunityInteger.java
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/WideCommunityInteger.java
@@ -104,9 +104,7 @@
 
         while (listIterator.hasNext()) {
             Integer integer = listIterator.next();
-            if (integer instanceof Integer) {
-                c.writeInt(integer);
-            }
+            c.writeInt(integer);
         }
 
         int length = c.writerIndex() - iLengthIndex;
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/WideCommunityIpV4Neighbour.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/WideCommunityIpV4Neighbour.java
index 96f4540..fa4ad67 100644
--- a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/WideCommunityIpV4Neighbour.java
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/WideCommunityIpV4Neighbour.java
@@ -96,10 +96,8 @@
 
         while (listIterator.hasNext()) {
             IpV4Neighbour speaker = listIterator.next();
-            if (speaker instanceof IpV4Neighbour) {
-                c.writeBytes(speaker.localSpeaker().toOctets());
-                c.writeBytes(speaker.remoteSpeaker().toOctets());
-            }
+            c.writeBytes(speaker.localSpeaker().toOctets());
+            c.writeBytes(speaker.remoteSpeaker().toOctets());
         }
 
         int length = c.writerIndex() - iLengthIndex;
diff --git a/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelProvider.java b/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelProvider.java
index d1afdc6..9b936e8 100644
--- a/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelProvider.java
+++ b/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelProvider.java
@@ -295,7 +295,7 @@
         // Get the pcc client
         PcepClient pc = pcepClientController.getClient(PccId.pccId(((IpTunnelEndPoint) tunnel.src()).ip()));
 
-        if (!(pc instanceof PcepClient)) {
+        if (pc == null) {
             log.error("There is no PCC connected with ip addresss {}"
                               + ((IpTunnelEndPoint) tunnel.src()).ip().toString());
             return;
@@ -352,7 +352,7 @@
 
         PcepClient pc = pcepClientController.getClient(PccId.pccId(((IpTunnelEndPoint) tunnel.src()).ip()));
 
-        if (!(pc instanceof PcepClient)) {
+        if (pc == null) {
             log.error("There is no PCC connected with this device {}"
                     + srcElement.toString());
             return;
@@ -382,7 +382,7 @@
 
         PcepClient pc = pcepClientController.getClient(PccId.pccId(((IpTunnelEndPoint) tunnel.src()).ip()));
 
-        if (!(pc instanceof PcepClient)) {
+        if (pc == null) {
             log.error("There is no PCC connected with ip addresss {}"
                     + ((IpTunnelEndPoint) tunnel.src()).ip().toString());
             return;
@@ -415,7 +415,7 @@
 
         PcepClient pc = pcepClientController.getClient(PccId.pccId(((IpElementId) srcElement).ipAddress()));
 
-        if (!(pc instanceof PcepClient)) {
+        if (pc == null) {
             log.error("There is no PCC connected with ip addresss {}"
                     + ((IpElementId) srcElement).ipAddress().toString());
             return;
@@ -459,7 +459,7 @@
 
         PcepClient pc = pcepClientController.getClient(PccId.pccId(((IpTunnelEndPoint) tunnel.src()).ip()));
 
-        if (!(pc instanceof PcepClient)) {
+        if (pc == null) {
             log.error("There is no PCC connected with ip addresss {}"
                     + ((IpTunnelEndPoint) tunnel.src()).ip().toString());
             return;
@@ -514,7 +514,7 @@
 
         PcepClient pc = pcepClientController.getClient(PccId.pccId(((IpElementId) srcElement).ipAddress()));
 
-        if (!(pc instanceof PcepClient)) {
+        if (pc == null) {
             log.error("There is no PCC connected with ip addresss {}"
                     + ((IpElementId) srcElement).ipAddress().toString());
             return;
@@ -1316,7 +1316,7 @@
                         srpObj = stateRpt.getSrpObject();
                         lspObj = stateRpt.getLspObject();
 
-                        if (srpObj instanceof PcepSrpObject) {
+                        if (srpObj != null) {
                             srpId = srpObj.getSrpID();
                         }
 
