aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-01-18 20:50:06 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2013-01-18 20:50:06 +1300
commit8161004d43dbd25ef78ea90c85ed20522008db05 (patch)
treee5576722761b10f82598696c51176998537e3dbf /src
parent234be1a3df650a3ff5bd3d4773f85093ff9bf32e (diff)
downloadtrackermap-server-8161004d43dbd25ef78ea90c85ed20522008db05.tar.gz
trackermap-server-8161004d43dbd25ef78ea90c85ed20522008db05.tar.bz2
trackermap-server-8161004d43dbd25ef78ea90c85ed20522008db05.zip
Enable progress hack
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/ProgressProtocolDecoder.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/org/traccar/protocol/ProgressProtocolDecoder.java b/src/org/traccar/protocol/ProgressProtocolDecoder.java
index d3f582225..43fce472c 100644
--- a/src/org/traccar/protocol/ProgressProtocolDecoder.java
+++ b/src/org/traccar/protocol/ProgressProtocolDecoder.java
@@ -68,14 +68,16 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder {
private void loadLastIndex() {
try {
Properties p = getServerManager().getProperties();
- AdvancedConnection connection = new AdvancedConnection(
- p.getProperty("database.url"), p.getProperty("database.user"), p.getProperty("database.password"));
- NamedParameterStatement queryLastIndex = new NamedParameterStatement(connection, p.getProperty("database.selectLastIndex"));
- queryLastIndex.prepare();
- queryLastIndex.setLong("device_id", deviceId);
- ResultSet result = queryLastIndex.executeQuery();
- if (result.next()) {
- lastIndex = result.getLong(1);
+ if (p.contains("database.selectLastIndex")) {
+ AdvancedConnection connection = new AdvancedConnection(
+ p.getProperty("database.url"), p.getProperty("database.user"), p.getProperty("database.password"));
+ NamedParameterStatement queryLastIndex = new NamedParameterStatement(connection, p.getProperty("database.selectLastIndex"));
+ queryLastIndex.prepare();
+ queryLastIndex.setLong("device_id", deviceId);
+ ResultSet result = queryLastIndex.executeQuery();
+ if (result.next()) {
+ lastIndex = result.getLong(1);
+ }
}
} catch(Exception error) {
}
@@ -120,7 +122,7 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder {
String imei = buf.readBytes(length).toString(Charset.defaultCharset());
try {
deviceId = getDataManager().getDeviceByImei(imei).getId();
- //loadLastIndex();
+ loadLastIndex();
} catch(Exception error) {
Log.warning("Unknown device - " + imei + " (id - " + id + ")");
}