aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-09 11:43:50 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-09 11:43:50 +1300
commit81a7fba08c37fd8032c747ada5d9a77340298647 (patch)
treeb7b0534868dfc130d1b8779ff0b8c7bf8c149dc5 /src/org/traccar/protocol/MeiligaoProtocolDecoder.java
parent8e555ab17b231d93ab51713d6cb25510c0f92476 (diff)
downloadtrackermap-server-81a7fba08c37fd8032c747ada5d9a77340298647.tar.gz
trackermap-server-81a7fba08c37fd8032c747ada5d9a77340298647.tar.bz2
trackermap-server-81a7fba08c37fd8032c747ada5d9a77340298647.zip
Fix some FindBugs and style issues
Diffstat (limited to 'src/org/traccar/protocol/MeiligaoProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index 4584c1862..6acdef406 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -81,7 +81,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
public static final int MSG_RFID = 0x9966;
private boolean identify(ChannelBuffer buf, Channel channel) {
- String id = "";
+ StringBuilder builder = new StringBuilder();
for (int i = 0; i < 7; i++) {
int b = buf.readUnsignedByte();
@@ -89,14 +89,16 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
// First digit
int d1 = (b & 0xf0) >> 4;
if (d1 == 0xf) break;
- id += d1;
+ builder.append(d1);
// Second digit
int d2 = b & 0x0f;
if (d2 == 0xf) break;
- id += d2;
+ builder.append(d2);
}
+ String id = builder.toString();
+
// Try to recreate full IMEI number
// Sometimes first digit is cut, so this won't work
if (id.length() == 14 && identify(id + Checksum.luhn(Long.parseLong(id)), channel, null, false)) {