diff options
-rw-r--r-- | src/org/traccar/protocol/GalileoProtocolDecoder.java | 3 | ||||
-rw-r--r-- | test/org/traccar/ProtocolDecoderTest.java | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/GalileoProtocolDecoder.java b/src/org/traccar/protocol/GalileoProtocolDecoder.java index 7c7de307d..ce8716291 100644 --- a/src/org/traccar/protocol/GalileoProtocolDecoder.java +++ b/src/org/traccar/protocol/GalileoProtocolDecoder.java @@ -122,8 +122,8 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { List<Position> positions = new LinkedList<>(); Set<Integer> tags = new HashSet<>(); boolean hasLocation = false; + Position position = new Position(); - position.setProtocol(getProtocolName()); while (buf.readerIndex() < length) { @@ -201,6 +201,7 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { sendReply(channel, buf.readUnsignedShort()); for (Position p : positions) { + p.setProtocol(getProtocolName()); p.setDeviceId(getDeviceId()); } diff --git a/test/org/traccar/ProtocolDecoderTest.java b/test/org/traccar/ProtocolDecoderTest.java index 95f00e5d1..12964049c 100644 --- a/test/org/traccar/ProtocolDecoderTest.java +++ b/test/org/traccar/ProtocolDecoderTest.java @@ -163,6 +163,8 @@ public class ProtocolDecoderTest { Assert.assertTrue("course >= 0", position.getCourse() >= 0); Assert.assertTrue("course <= 360", position.getCourse() <= 360); + Assert.assertNotNull("protocol is null", position.getProtocol()); + } private void verifyDecodedPosition(Object decodedObject) { @@ -192,6 +194,8 @@ public class ProtocolDecoderTest { Assert.assertTrue("course >= 0", position.getCourse() >= 0); Assert.assertTrue("course <= 360", position.getCourse() <= 360); + Assert.assertNotNull("protocol is null", position.getProtocol()); + } } |