From 7e2ed343d2a6a03938c3f074417464c63d31fd59 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 17 Sep 2018 15:50:19 +1200 Subject: Remove joda time library --- src/org/traccar/web/CsvBuilder.java | 8 +++----- src/org/traccar/web/GpxBuilder.java | 9 ++------- src/org/traccar/web/WebServer.java | 1 - 3 files changed, 5 insertions(+), 13 deletions(-) (limited to 'src/org/traccar/web') diff --git a/src/org/traccar/web/CsvBuilder.java b/src/org/traccar/web/CsvBuilder.java index 29e2ccfbc..f7455b528 100644 --- a/src/org/traccar/web/CsvBuilder.java +++ b/src/org/traccar/web/CsvBuilder.java @@ -19,6 +19,7 @@ package org.traccar.web; import java.beans.Introspector; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.time.format.DateTimeFormatter; import java.util.Arrays; import java.util.Collection; import java.util.Comparator; @@ -28,9 +29,6 @@ import java.util.SortedSet; import java.util.TreeSet; import com.fasterxml.jackson.core.JsonProcessingException; -import org.joda.time.DateTime; -import org.joda.time.format.DateTimeFormatter; -import org.joda.time.format.ISODateTimeFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.traccar.Context; @@ -41,7 +39,6 @@ public class CsvBuilder { private static final String LINE_ENDING = "\r\n"; private static final String SEPARATOR = ";"; - private static final DateTimeFormatter DATE_FORMAT = ISODateTimeFormat.dateTime(); private StringBuilder builder = new StringBuilder(); @@ -94,7 +91,7 @@ public class CsvBuilder { addSeparator(); } else if (method.getReturnType().equals(Date.class)) { Date value = (Date) method.invoke(object); - builder.append(DATE_FORMAT.print(new DateTime(value))); + builder.append(DateTimeFormatter.ISO_DATE_TIME.format(value.toInstant())); addSeparator(); } else if (method.getReturnType().equals(Map.class)) { Map value = (Map) method.invoke(object); @@ -163,4 +160,5 @@ public class CsvBuilder { public String build() { return builder.toString(); } + } diff --git a/src/org/traccar/web/GpxBuilder.java b/src/org/traccar/web/GpxBuilder.java index bac7182dc..a4daf154e 100644 --- a/src/org/traccar/web/GpxBuilder.java +++ b/src/org/traccar/web/GpxBuilder.java @@ -16,11 +16,8 @@ */ package org.traccar.web; +import java.time.format.DateTimeFormatter; import java.util.Collection; - -import org.joda.time.DateTime; -import org.joda.time.format.DateTimeFormatter; -import org.joda.time.format.ISODateTimeFormat; import org.traccar.helper.UnitsConverter; import org.traccar.model.Position; @@ -41,8 +38,6 @@ public class GpxBuilder { + "%n"; private static final String FOOTER = ""; - private static final DateTimeFormatter DATE_FORMAT = ISODateTimeFormat.dateTime(); - public GpxBuilder() { builder.append(HEADER); builder.append("\n"); @@ -55,7 +50,7 @@ public class GpxBuilder { public void addPosition(Position position) { builder.append(String.format(POINT, position.getLatitude(), position.getLongitude(), - DATE_FORMAT.print(new DateTime(position.getFixTime())), position.getAltitude(), + DateTimeFormatter.ISO_DATE_TIME.format(position.getFixTime().toInstant()), position.getAltitude(), position.getCourse(), UnitsConverter.mpsFromKnots(position.getSpeed()))); } diff --git a/src/org/traccar/web/WebServer.java b/src/org/traccar/web/WebServer.java index 4bb88578f..90ea74a3b 100644 --- a/src/org/traccar/web/WebServer.java +++ b/src/org/traccar/web/WebServer.java @@ -130,7 +130,6 @@ public class WebServer { resourceHandler.setResourceBase(config.getString("web.path")); if (config.getBoolean("web.debug")) { resourceHandler.setWelcomeFiles(new String[] {"debug.html", "index.html"}); - resourceHandler.setMinMemoryMappedContentLength(-1); // avoid locking files on Windows } else { String cache = config.getString("web.cacheControl"); if (cache != null && !cache.isEmpty()) { -- cgit v1.2.3