Skip to content
Snippets Groups Projects
Commit bca5e908 authored by Rob Adams's avatar Rob Adams
Browse files

Fix null pointer exception in device manager and add last seen to device serializer

parent 56b64e4c
No related branches found
No related tags found
No related merge requests found
......@@ -267,20 +267,23 @@ public class DeviceManagerImpl implements
else {
long e1ts = e1t.getTime();
long e2ts = e2t.getTime();
if (topology.
isBroadcastDomainPort(e1.getSwitchDPID(),
e1.getSwitchPort().
if (e1.getSwitchDPID() != null &&
e2.getSwitchPort() != null) {
if (topology.
isBroadcastDomainPort(e1.getSwitchDPID(),
e1.getSwitchPort().
shortValue())) {
e1ts -= NBD_TO_BD_TIMEDIFF_MS;
}
if (topology.
isBroadcastDomainPort(e2.getSwitchDPID(),
e2.getSwitchPort().
e1ts -= NBD_TO_BD_TIMEDIFF_MS;
}
if (topology.
isBroadcastDomainPort(e2.getSwitchDPID(),
e2.getSwitchPort().
shortValue())) {
e2ts -= NBD_TO_BD_TIMEDIFF_MS;
e2ts -= NBD_TO_BD_TIMEDIFF_MS;
}
r = Long.valueOf(e1ts).compareTo(e2ts);
}
r = Long.valueOf(e1ts).compareTo(e2ts);
}
return r;
......
......@@ -64,6 +64,8 @@ public class DeviceSerializer extends JsonSerializer<Device> {
}
jGen.writeEndArray();
jGen.writeNumberField("lastSeen", device.getLastSeen().getTime());
jGen.writeEndObject();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment