From 74c93c7cef8fe3ef53ba17b3c9da7b374003d042 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 13 Oct 2015 13:17:35 +1300 Subject: Fix minor style issues in Meiligao --- .../traccar/protocol/MeiligaoProtocolDecoder.java | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/org') diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java index 67330cca4..7e2aa062d 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java @@ -18,9 +18,6 @@ package org.traccar.protocol; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.nio.charset.Charset; -import java.util.Calendar; -import java.util.TimeZone; -import java.util.regex.Matcher; import java.util.regex.Pattern; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; @@ -90,12 +87,16 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { // First digit int d1 = (b & 0xf0) >> 4; - if (d1 == 0xf) break; + if (d1 == 0xf) { + break; + } builder.append(d1); // Second digit int d2 = b & 0x0f; - if (d2 == 0xf) break; + if (d2 == 0xf) { + break; + } builder.append(d2); } @@ -210,8 +211,14 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { } } - Parser parser = new Parser(command == MSG_RFID ? PATTERN_RFID : PATTERN, - buf.toString(buf.readerIndex(), buf.readableBytes() - 4, Charset.defaultCharset())); + Pattern pattern; + if (command == MSG_RFID) { + pattern = PATTERN_RFID; + } else { + pattern = PATTERN; + } + + Parser parser = new Parser(pattern, buf.toString(buf.readerIndex(), buf.readableBytes() - 4, Charset.defaultCharset())); if (!parser.matches()) { return null; } -- cgit v1.2.3