SONAR suggestions - more blocker bugs
- fixed some cases where pointers could be null
- fixed some booleans statements known to always be
true or false
Change-Id: I0d67c1794b37deeccffda1f4ad0f447857e2a5d1
diff --git a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp6HandlerImpl.java b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp6HandlerImpl.java
index 2990e5a..0cb3468 100644
--- a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp6HandlerImpl.java
+++ b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp6HandlerImpl.java
@@ -626,15 +626,17 @@
}
}
- record.getV6Counters().incrementCounter(dhcp6HandlerUtil.getMsgTypeStr(leafMsgType));
- record.addLocation(new HostLocation(location, System.currentTimeMillis()));
- record.ip6Status(DHCP6.MsgType.getType(leafMsgType));
- record.setDirectlyConnected(directConnFlag);
- if (!directConnFlag) {
- // Update gateway mac address if the host is not directly connected
- record.nextHop(srcMac);
+ if (record != null) {
+ record.getV6Counters().incrementCounter(dhcp6HandlerUtil.getMsgTypeStr(leafMsgType));
+ record.addLocation(new HostLocation(location, System.currentTimeMillis()));
+ record.ip6Status(DHCP6.MsgType.getType(leafMsgType));
+ record.setDirectlyConnected(directConnFlag);
+ if (!directConnFlag) {
+ // Update gateway mac address if the host is not directly connected
+ record.nextHop(srcMac);
+ }
+ record.updateLastSeen();
}
- record.updateLastSeen();
dhcpRelayStore.updateDhcpRecord(leafHostId, record);
// TODO Use AtomicInteger for the counters
try {