diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-11-11 20:23:08 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-11-11 20:23:08 -0800 |
commit | 965ef9eb530963e71ce33c2a06af389c78192b51 (patch) | |
tree | e8ad77c995524d71289d7667f32ab5bb8efc03e0 /src/main/java | |
parent | f78da0d7ead0e445f129eac486cc468bedff7c73 (diff) | |
download | trackermap-server-965ef9eb530963e71ce33c2a06af389c78192b51.tar.gz trackermap-server-965ef9eb530963e71ce33c2a06af389c78192b51.tar.bz2 trackermap-server-965ef9eb530963e71ce33c2a06af389c78192b51.zip |
Handle new lines
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/traccar/protocol/MobilogixProtocol.java | 4 | ||||
-rw-r--r-- | src/main/java/org/traccar/protocol/MobilogixProtocolDecoder.java | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/MobilogixProtocol.java b/src/main/java/org/traccar/protocol/MobilogixProtocol.java index ebf2c9c7f..28380a2af 100644 --- a/src/main/java/org/traccar/protocol/MobilogixProtocol.java +++ b/src/main/java/org/traccar/protocol/MobilogixProtocol.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Anton Tananaev (anton@traccar.org) + * Copyright 2020 - 2021 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ public class MobilogixProtocol extends BaseProtocol { addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { - pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, "]\r\n", "]")); + pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, ']')); pipeline.addLast(new StringEncoder()); pipeline.addLast(new StringDecoder()); pipeline.addLast(new MobilogixProtocolDecoder(MobilogixProtocol.this)); diff --git a/src/main/java/org/traccar/protocol/MobilogixProtocolDecoder.java b/src/main/java/org/traccar/protocol/MobilogixProtocolDecoder.java index 7947d0c26..f3b70e40c 100644 --- a/src/main/java/org/traccar/protocol/MobilogixProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/MobilogixProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Anton Tananaev (anton@traccar.org) + * Copyright 2020 - 2021 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,7 +83,7 @@ public class MobilogixProtocolDecoder extends BaseProtocolDecoder { protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { - String sentence = (String) msg; + String sentence = ((String) msg).trim(); String type = sentence.substring(21, sentence.indexOf(',', 21)); if (channel != null) { |