From e954e95547d05a34bbd36e3aa5003f4ddaf2ccd0 Mon Sep 17 00:00:00 2001 From: ninioe Date: Tue, 19 Jul 2016 15:12:38 +0300 Subject: changes Anton asked me --- src/org/traccar/BasePipelineFactory.java | 6 +++++- src/org/traccar/Main.java | 4 +++- src/org/traccar/database/DataManager.java | 4 +--- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/BasePipelineFactory.java b/src/org/traccar/BasePipelineFactory.java index eb08c7e08..31845290f 100644 --- a/src/org/traccar/BasePipelineFactory.java +++ b/src/org/traccar/BasePipelineFactory.java @@ -29,7 +29,11 @@ import org.jboss.netty.channel.MessageEvent; import org.jboss.netty.channel.SimpleChannelHandler; import org.jboss.netty.handler.logging.LoggingHandler; import org.jboss.netty.handler.timeout.IdleStateHandler; -import org.traccar.events.*; +import org.traccar.events.CommandResultEventHandler; +import org.traccar.events.GeofenceEventHandler; +import org.traccar.events.MotionEventHandler; +import org.traccar.events.OverspeedEventHandler; +import org.traccar.events.AlertEventHandler; import org.traccar.helper.Log; import java.net.InetSocketAddress; diff --git a/src/org/traccar/Main.java b/src/org/traccar/Main.java index 45374ca15..baad9d040 100644 --- a/src/org/traccar/Main.java +++ b/src/org/traccar/Main.java @@ -16,6 +16,8 @@ package org.traccar; import org.traccar.helper.Log; + +import java.sql.SQLException; import java.util.Timer; import java.util.TimerTask; import java.util.Locale; @@ -44,7 +46,7 @@ public final class Main { public void run() { try { Context.getDataManager().clearPositionsHistory(); - } catch (Exception error) { + } catch (SQLException error) { Log.warning(error); } } diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index e5a245568..3c8529eff 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -399,7 +399,6 @@ public class DataManager { } public void clearPositionsHistory() throws SQLException { - //SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd"); int histDays = config.getInteger("database.positionsHistoryDays"); if (histDays == 0) { return; @@ -414,8 +413,7 @@ public class DataManager { Date lastUpdate = device.getLastUpdate(); if(lastUpdate != null){ - Date dateBefore = new Date(lastUpdate.getTime() - histDays * 24 * 3600 * 1000 ); - //String dt = s.format(dateBefore); + Date dateBefore = new Date(lastUpdate.getTime() - histDays * 24 * 3600 * 1000); QueryBuilder.create(dataSource, sql) .setLong("deviceId", device.getId()) -- cgit v1.2.3