Clamp the imported timestamp within reasonable limits.

This commit is contained in:
akwizgran
2017-04-13 16:21:00 +01:00
parent 1b48d661e8
commit 115d488bc3

View File

@@ -467,11 +467,11 @@ class FeedManagerImpl implements FeedManager, Client, EventListener,
// get other information for post // get other information for post
GroupId groupId = feed.getBlogId(); GroupId groupId = feed.getBlogId();
long time; long time, now = clock.currentTimeMillis();
Date date = entry.getUpdatedDate(); Date date = entry.getUpdatedDate();
if (date == null) date = entry.getPublishedDate(); if (date == null) date = entry.getPublishedDate();
if (date == null) time = clock.currentTimeMillis(); if (date == null) time = now;
else time = date.getTime(); else time = Math.max(0, Math.min(date.getTime(), now));
String body = getPostBody(b.toString()); String body = getPostBody(b.toString());
try { try {
// create and store post // create and store post