commit | 15813842f02e0410d9a7630362ea9adddcdf30ef | [log] [tgz] |
---|---|---|
author | Yi Tseng <yi@opennetworking.org> | Mon Oct 02 14:27:24 2017 -0700 |
committer | Thomas Vachuska <tom@opennetworking.org> | Tue Oct 03 16:33:45 2017 +0000 |
tree | 8f56237af21a12b4092c143c5cfb8e2a394f3069 | |
parent | 62ba45f70c28b5af77659597e9205c92a549df14 [diff] |
[CORD-1925] Fix null pointer exception in DHCP relay store NPE happened when remove DHCP record Change-Id: I4b4c564d086c4e274aefa0ebce5d52cd622596d0
diff --git a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/store/DistributedDhcpRelayStore.java b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/store/DistributedDhcpRelayStore.java index 1e87ba6..38c0580 100644 --- a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/store/DistributedDhcpRelayStore.java +++ b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/store/DistributedDhcpRelayStore.java
@@ -66,7 +66,13 @@ protected void activated() { dhcpRecords = storageService.<HostId, DhcpRecord>eventuallyConsistentMapBuilder() .withName("DHCP-Relay-Records") - .withTimestampProvider((hostId, record) -> new WallClockTimestamp(record.lastSeen())) + .withTimestampProvider((hostId, record) -> { + if (record != null) { + return new WallClockTimestamp(record.lastSeen()); + } else { + return new WallClockTimestamp(); + } + }) .withSerializer(APP_KRYO) .build(); listener = new InternalMapListener();