diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-07-14 15:15:31 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-07-14 15:15:31 +1200 |
commit | 7310ee5f15729ea8517bfb6b0890a46da1217610 (patch) | |
tree | 44504738f127708420179a7dbbe2942cb67d0849 /src/org/traccar/protocol/NavisProtocolDecoder.java | |
parent | 8e8da7019aab023ae255d0ed6d16b94d303fd468 (diff) | |
parent | 0a6faa86c4b634fa3a94633506c4422623e36f1e (diff) | |
download | trackermap-server-7310ee5f15729ea8517bfb6b0890a46da1217610.tar.gz trackermap-server-7310ee5f15729ea8517bfb6b0890a46da1217610.tar.bz2 trackermap-server-7310ee5f15729ea8517bfb6b0890a46da1217610.zip |
Merge Java 7 update (fix #1273)
Diffstat (limited to 'src/org/traccar/protocol/NavisProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/NavisProtocolDecoder.java | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/org/traccar/protocol/NavisProtocolDecoder.java b/src/org/traccar/protocol/NavisProtocolDecoder.java index 02d408575..4f3e6a1a4 100644 --- a/src/org/traccar/protocol/NavisProtocolDecoder.java +++ b/src/org/traccar/protocol/NavisProtocolDecoder.java @@ -15,19 +15,16 @@ */ package org.traccar.protocol; +import java.net.SocketAddress; import java.nio.ByteOrder; import java.nio.charset.Charset; -import java.net.SocketAddress; import java.util.Calendar; import java.util.LinkedList; import java.util.List; import java.util.TimeZone; - import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; -import org.jboss.netty.channel.ChannelHandlerContext; - import org.traccar.BaseProtocolDecoder; import org.traccar.model.Event; import org.traccar.model.Position; @@ -228,7 +225,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder { } private Object processArray(Channel channel, ChannelBuffer buf) { - List<Position> positions = new LinkedList<Position>(); + List<Position> positions = new LinkedList<>(); int count = buf.readUnsignedByte(); for (int i = 0; i < count; i++) { @@ -303,13 +300,14 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder { // Read message type String type = buf.toString(buf.readerIndex(), 3, charset); buf.skipBytes(type.length()); - - if (type.equals("*>T")) { - return processSingle(channel, buf); - } else if (type.equals("*>A")) { - return processArray(channel, buf); - } else if (type.equals("*>S")) { - return processHandshake(channel, buf); + + switch (type) { + case "*>T": + return processSingle(channel, buf); + case "*>A": + return processArray(channel, buf); + case "*>S": + return processHandshake(channel, buf); } return null; |