remove unnecessary method

(cherry picked from commit b037b98)
This commit is contained in:
Chumva 2018-08-02 11:37:31 +03:00
parent 3361d4ee8b
commit 14521d59ce

View file

@ -14,14 +14,10 @@ import java.io.File;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
@ -81,7 +77,7 @@ public class IncrementalChangesManager {
List<String> list = new ArrayList<String>(regionUpdateFiles.monthUpdates.keySet());
for (String month : list) {
RegionUpdate ru = regionUpdateFiles.monthUpdates.get(month);
if (checkIfItemOutdated(ru, dateCreated)) {
if (ru.obfCreated <= dateCreated) {
log.info("Delete overlapping month update " + ru.file.getName());
resourceManager.closeFile(ru.file.getName());
regionUpdateFiles.monthUpdates.remove(month);
@ -101,7 +97,7 @@ public class IncrementalChangesManager {
if(ru == null) {
continue;
}
if ((checkIfItemOutdated(ru, dateCreated)) ||
if (ru.obfCreated <= dateCreated ||
(monthRu != null && ru.obfCreated < monthRu.obfCreated)) {
log.info("Delete overlapping day update " + ru.file.getName());
resourceManager.closeFile(ru.file.getName());
@ -415,27 +411,4 @@ public class IncrementalChangesManager {
}
return timestamp;
}
private boolean checkIfItemOutdated(RegionUpdate ru, long dateMainMapCreated) {
boolean outdated = false;
Date strDate = null;
String date = ru.date;
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);
} else {
strDate = new SimpleDateFormat("yy_MM_dd", Locale.getDefault()).parse(date);
}
} catch (ParseException e) {
e.printStackTrace();
}
if (strDate != null && dateMainMapCreated > strDate.getTime()) {
outdated = true;
}
}
return outdated;
}
}