aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/OrionFrameDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-08 15:08:33 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-08 15:08:33 +1300
commiteb4ee7a9d4d0f132546b164c3483d62eb9e9f0db (patch)
tree29bc56f0f67cd49bac31a50e415c614ed4b1c5dc /src/org/traccar/protocol/OrionFrameDecoder.java
parent320d41863864485c5675c9bf8332ff0845e5e812 (diff)
downloadtrackermap-server-eb4ee7a9d4d0f132546b164c3483d62eb9e9f0db.tar.gz
trackermap-server-eb4ee7a9d4d0f132546b164c3483d62eb9e9f0db.tar.bz2
trackermap-server-eb4ee7a9d4d0f132546b164c3483d62eb9e9f0db.zip
Clean up reported PMD issues
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);
}
+
}
}