aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/OrionFrameDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/OrionFrameDecoder.java')
-rw-r--r--src/org/traccar/protocol/OrionFrameDecoder.java43
1 files changed, 21 insertions, 22 deletions
diff --git a/src/org/traccar/protocol/OrionFrameDecoder.java b/src/org/traccar/protocol/OrionFrameDecoder.java
index 033dbd1d5..3babda175 100644
--- a/src/org/traccar/protocol/OrionFrameDecoder.java
+++ b/src/org/traccar/protocol/OrionFrameDecoder.java
@@ -34,34 +34,33 @@ public class OrionFrameDecoder extends FrameDecoder {
int type = buf.getUnsignedByte(buf.readerIndex() + 2) & 0x0f;
- if (type == OrionProtocolDecoder.MSG_USERLOG) {
- if (buf.readableBytes() >= length + 5) {
+ if (type == OrionProtocolDecoder.MSG_USERLOG && buf.readableBytes() >= length + 5) {
- int index = buf.readerIndex() + 3;
- int count = buf.getUnsignedByte(index) & 0x0f;
- index += 5;
- length += 5;
+ int index = buf.readerIndex() + 3;
+ int count = buf.getUnsignedByte(index) & 0x0f;
+ index += 5;
+ length += 5;
- for (int i = 0; i < count; i++) {
- if (buf.readableBytes() < length) {
- return null;
- }
- int logLength = buf.getUnsignedByte(index + 1);
- index += logLength;
- length += logLength;
+ for (int i = 0; i < count; i++) {
+ if (buf.readableBytes() < length) {
+ return null;
}
+ int logLength = buf.getUnsignedByte(index + 1);
+ index += logLength;
+ length += logLength;
+ }
- if (buf.readableBytes() >= length) {
- return buf.readBytes(length);
- }
+ if (buf.readableBytes() >= length) {
+ return buf.readBytes(length);
}
- } else if (type == OrionProtocolDecoder.MSG_SYSLOG) {
- if (buf.readableBytes() >= length + 12) {
- length += buf.getUnsignedShort(buf.readerIndex() + 8);
- if (buf.readableBytes() >= length) {
- return buf.readBytes(length);
- }
+
+ } else if (type == OrionProtocolDecoder.MSG_SYSLOG && buf.readableBytes() >= length + 12) {
+
+ length += buf.getUnsignedShort(buf.readerIndex() + 8);
+ if (buf.readableBytes() >= length) {
+ return buf.readBytes(length);
}
+
}
}