Bug 6759: Fix NPE when request for expired mapping
[lispflowmapping.git] / mappingservice / mapcache / src / main / java / org / opendaylight / lispflowmapping / mapcache / SimpleMapCache.java
index e8226fa4cbcfd2ad637a8206867459a70bbd492f..ebc710b1223dbb011c9a37872eeb433841a9c1c2 100644 (file)
@@ -173,11 +173,12 @@ public class SimpleMapCache implements IMapCache {
                 }
             } else {
                 Date timestamp = (Date) daoEntry.getValue().get(SubKeys.REGDATE);
+                Object record = daoEntry.getValue().get(SubKeys.RECORD);
                 if (timestamp != null && MappingMergeUtil.timestampIsExpired(timestamp)) {
                     dao.removeSpecific(daoEntry.getKey(), SubKeys.REGDATE);
                     dao.removeSpecific(daoEntry.getKey(), SubKeys.RECORD);
                 }
-                return daoEntry.getValue().get(SubKeys.RECORD);
+                return record;
             }
         } else {
             return null;