From a0dd42e1e8217701faf41972f3f1b9eda0be5256 Mon Sep 17 00:00:00 2001 From: Chumva Date: Wed, 1 Aug 2018 18:45:08 +0300 Subject: [PATCH] add date check in checkIfItemOutdated --- .../osmand/plus/resources/IncrementalChangesManager.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/resources/IncrementalChangesManager.java b/OsmAnd/src/net/osmand/plus/resources/IncrementalChangesManager.java index 92eb2e9b20..64cb2a3fef 100644 --- a/OsmAnd/src/net/osmand/plus/resources/IncrementalChangesManager.java +++ b/OsmAnd/src/net/osmand/plus/resources/IncrementalChangesManager.java @@ -81,7 +81,7 @@ public class IncrementalChangesManager { List list = new ArrayList(regionUpdateFiles.monthUpdates.keySet()); for (String month : list) { RegionUpdate ru = regionUpdateFiles.monthUpdates.get(month); - if (ru.obfCreated < dateCreated || checkIfItemOutdated(ru, dateCreated)) { + if (checkIfItemOutdated(ru, dateCreated)) { log.info("Delete overlapping month update " + ru.file.getName()); resourceManager.closeFile(ru.file.getName()); regionUpdateFiles.monthUpdates.remove(month); @@ -101,7 +101,7 @@ public class IncrementalChangesManager { if(ru == null) { continue; } - if (ru.obfCreated < dateCreated || (checkIfItemOutdated(ru, dateCreated)) || + if ((checkIfItemOutdated(ru, dateCreated)) || (monthRu != null && ru.obfCreated < monthRu.obfCreated)) { log.info("Delete overlapping day update " + ru.file.getName()); resourceManager.closeFile(ru.file.getName()); @@ -420,7 +420,9 @@ public class IncrementalChangesManager { boolean outdated = false; Date strDate = null; String date = ru.date; - if (!Algorithms.isEmpty(date) && ru.obfCreated == dateMainMapCreated) { + if (ru.obfCreated < dateMainMapCreated) { + outdated = true; + } else if (!Algorithms.isEmpty(date) && ru.obfCreated == dateMainMapCreated) { try { if (date.endsWith("00")) { strDate = new SimpleDateFormat("yy_MM", Locale.getDefault()).parse(date);