From 42cf2358fefa5176a3c72478a778ae382c9e1836 Mon Sep 17 00:00:00 2001 From: Christoph Krey Date: Thu, 29 Jun 2017 13:10:16 +0200 Subject: [FIX] Aplicom protocol does not ignore Alive messages #3305 --- src/org/traccar/protocol/AplicomFrameDecoder.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/org/traccar/protocol') diff --git a/src/org/traccar/protocol/AplicomFrameDecoder.java b/src/org/traccar/protocol/AplicomFrameDecoder.java index 785d90767..e12848f8f 100644 --- a/src/org/traccar/protocol/AplicomFrameDecoder.java +++ b/src/org/traccar/protocol/AplicomFrameDecoder.java @@ -26,6 +26,11 @@ public class AplicomFrameDecoder extends FrameDecoder { protected Object decode( ChannelHandlerContext ctx, Channel channel, ChannelBuffer buf) throws Exception { + // Skip Alive message + while (buf.readableBytes() > 0 && Character.isDigit(buf.getByte(buf.readerIndex()))) { + buf.readByte(); + } + // Check minimum length if (buf.readableBytes() < 11) { return null; -- cgit v1.2.3 From c12a28b811b3310eab5942e9c3650d50c2df1606 Mon Sep 17 00:00:00 2001 From: Christoph Krey Date: Fri, 30 Jun 2017 08:38:20 +0200 Subject: [FIX] use readable() instead of testing readableBytes() --- src/org/traccar/protocol/AplicomFrameDecoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/org/traccar/protocol') diff --git a/src/org/traccar/protocol/AplicomFrameDecoder.java b/src/org/traccar/protocol/AplicomFrameDecoder.java index e12848f8f..24d55f1cf 100644 --- a/src/org/traccar/protocol/AplicomFrameDecoder.java +++ b/src/org/traccar/protocol/AplicomFrameDecoder.java @@ -27,7 +27,7 @@ public class AplicomFrameDecoder extends FrameDecoder { ChannelHandlerContext ctx, Channel channel, ChannelBuffer buf) throws Exception { // Skip Alive message - while (buf.readableBytes() > 0 && Character.isDigit(buf.getByte(buf.readerIndex()))) { + while (buf.readable() && Character.isDigit(buf.getByte(buf.readerIndex()))) { buf.readByte(); } -- cgit v1.2.3