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

Fix some failing unit tests

parent f023462d
No related branches found
No related tags found
No related merge requests found
......@@ -918,8 +918,9 @@ public class DeviceManagerImpl implements
int entityindex = -1;
if ((entityindex = device.entityIndex(entity)) >= 0) {
// update timestamp on the found entity
device.entities[entityindex].
setLastSeenTimestamp(entity.getLastSeenTimestamp());
Date lastSeen = entity.getLastSeenTimestamp();
if (lastSeen == null) lastSeen = new Date();
device.entities[entityindex].setLastSeenTimestamp(lastSeen);
break;
} else {
Device newDevice = allocateDevice(device, entity, classes);
......
......@@ -148,7 +148,8 @@ public class Entity implements Comparable<Entity> {
* @see {@link Entity#activeSince}
*/
public void setLastSeenTimestamp(Date lastSeenTimestamp) {
if ((activeSince.getTime() + ACTIVITY_TIMEOUT) <
if (activeSince == null ||
(activeSince.getTime() + ACTIVITY_TIMEOUT) <
lastSeenTimestamp.getTime())
this.activeSince = lastSeenTimestamp;
this.lastSeenTimestamp = lastSeenTimestamp;
......
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