diff --git a/commons/src/main/java/org/archive/io/Arc2Warc.java b/commons/src/main/java/org/archive/io/Arc2Warc.java index c00a4d982..0e1f3c5e3 100644 --- a/commons/src/main/java/org/archive/io/Arc2Warc.java +++ b/commons/src/main/java/org/archive/io/Arc2Warc.java @@ -23,6 +23,8 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -50,10 +52,6 @@ import org.archive.uid.UUIDGenerator; import org.archive.util.FileUtils; import org.archive.util.anvl.ANVLRecord; -import org.joda.time.DateTimeZone; -import org.joda.time.format.DateTimeFormat; -import org.joda.time.format.ISODateTimeFormat; - /** * Convert ARCs to (sortof) WARCs. @@ -61,6 +59,8 @@ * @version $Date$ $Revision$ */ public class Arc2Warc { + private static final DateTimeFormatter ARC_DATE_FORMAT = DateTimeFormatter.ofPattern("yyyyMMddHHmmss") + .withZone(ZoneOffset.UTC); protected RecordIDGenerator generator = new UUIDGenerator(); private static void usage(HelpFormatter formatter, Options options, @@ -156,10 +156,8 @@ protected void write(final WARCWriter writer, final ARCRecord r) // convert ARC date to WARC-Date format String arcDateString = r.getHeader().getDate(); - String warcDateString = DateTimeFormat.forPattern("yyyyMMddHHmmss") - .withZone(DateTimeZone.UTC) - .parseDateTime(arcDateString) - .toString(ISODateTimeFormat.dateTimeNoMillis()); + + String warcDateString = DateTimeFormatter.ISO_DATE_TIME.format(ARC_DATE_FORMAT.parse(arcDateString)); recordInfo.setCreate14DigitDate(warcDateString); ANVLRecord ar = new ANVLRecord(); diff --git a/engine/pom.xml b/engine/pom.xml index 525296bc4..15e02ebe9 100644 --- a/engine/pom.xml +++ b/engine/pom.xml @@ -70,11 +70,6 @@ org.restlet.ext.crypto 2.4.0 - - joda-time - joda-time - 1.6 - javax.xml.bind diff --git a/engine/src/main/java/org/archive/crawler/framework/CrawlJob.java b/engine/src/main/java/org/archive/crawler/framework/CrawlJob.java index 994c0a242..ded08b85e 100644 --- a/engine/src/main/java/org/archive/crawler/framework/CrawlJob.java +++ b/engine/src/main/java/org/archive/crawler/framework/CrawlJob.java @@ -29,6 +29,7 @@ import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.nio.charset.StandardCharsets; +import java.time.Instant; import java.util.Collections; import java.util.HashMap; import java.util.LinkedHashMap; @@ -68,7 +69,6 @@ import org.archive.util.ArchiveUtils; import org.archive.util.ObjectIdentityCache; import org.archive.util.TextUtils; -import org.joda.time.DateTime; import org.springframework.beans.BeanWrapperImpl; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanCreationException; @@ -98,10 +98,10 @@ public class CrawlJob implements Comparable, ApplicationListener= getPrimaryConfig().lastModified(); + return xmlOkAt.toEpochMilli() >= getPrimaryConfig().lastModified(); } @@ -588,7 +588,7 @@ protected synchronized void doTeardown() { // all this stuff should happen even in case ac.close() bugs out ac = null; - xmlOkAt = new DateTime(0); + xmlOkAt = Instant.ofEpochMilli(0); if (currentLaunchJobLogHandler != null) { getJobLogger().removeHandler(currentLaunchJobLogHandler); @@ -615,7 +615,7 @@ public class JobLogFormatter extends Formatter { public String format(LogRecord record) { StringBuilder sb = new StringBuilder(); sb - .append(new DateTime(record.getMillis())) + .append(Instant.ofEpochMilli(record.getMillis())) .append(" ") .append(record.getLevel()) .append(" ") diff --git a/engine/src/main/java/org/archive/crawler/restlet/models/CrawlJobModel.java b/engine/src/main/java/org/archive/crawler/restlet/models/CrawlJobModel.java index 1ea8d8714..929a9cf1f 100644 --- a/engine/src/main/java/org/archive/crawler/restlet/models/CrawlJobModel.java +++ b/engine/src/main/java/org/archive/crawler/restlet/models/CrawlJobModel.java @@ -148,7 +148,7 @@ public String doubleToString(double number, int digits){ } public String getLastLaunchTime(){ long ago = System.currentTimeMillis() - - crawlJob.getLastLaunch().getMillis(); + - crawlJob.getLastLaunch().toEpochMilli(); return ArchiveUtils.formatMillisecondsToConventional(ago, 2); } /*