aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/OsmAndProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/OsmAndProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/OsmAndProtocolDecoder.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/OsmAndProtocolDecoder.java b/src/org/traccar/protocol/OsmAndProtocolDecoder.java
index 50903f52a..5cb6e6455 100644
--- a/src/org/traccar/protocol/OsmAndProtocolDecoder.java
+++ b/src/org/traccar/protocol/OsmAndProtocolDecoder.java
@@ -15,6 +15,7 @@
*/
package org.traccar.protocol;
+import java.nio.charset.Charset;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -47,6 +48,11 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder {
HttpRequest request = (HttpRequest) msg;
QueryStringDecoder decoder = new QueryStringDecoder(request.getUri());
Map<String, List<String>> params = decoder.getParameters();
+ if (params.isEmpty()) {
+ decoder = new QueryStringDecoder(
+ request.getContent().toString(Charset.defaultCharset()), false);
+ params = decoder.getParameters();
+ }
// Create new position
Position position = new Position();
@@ -58,6 +64,7 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDataManager().getDeviceByImei(id).getId());
} catch(Exception error) {
Log.warning("Unknown device - " + id);
+ return null;
}
// Decode position