aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-13 11:24:32 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-13 11:24:32 +1300
commit8d1e3f1f7e35e5bc0c2898ca9c9d840ef9676cd8 (patch)
treebf00317718de4a715ebf058b3ae0d6992b2d45a3 /src/org/traccar/protocol
parent43a64fc359f8acf08f97d70ebdb93dafa607dc08 (diff)
downloadtraccar-server-8d1e3f1f7e35e5bc0c2898ca9c9d840ef9676cd8.tar.gz
traccar-server-8d1e3f1f7e35e5bc0c2898ca9c9d840ef9676cd8.tar.bz2
traccar-server-8d1e3f1f7e35e5bc0c2898ca9c9d840ef9676cd8.zip
Fix last reported FindBugs issues
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/AplicomProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/CellocatorFrameDecoder.java4
-rw-r--r--src/org/traccar/protocol/Mta6ProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/TytanProtocolDecoder.java17
4 files changed, 18 insertions, 10 deletions
diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java
index c134a282e..9e0bddfcb 100644
--- a/src/org/traccar/protocol/AplicomProtocolDecoder.java
+++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java
@@ -248,6 +248,8 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
case 130:
buf.readUnsignedInt(); // incorrect
break;
+ default:
+ break;
}
}
@@ -321,6 +323,8 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
case 0x18:
position.set("software-version", ChannelBuffers.swapInt(value.readInt()) * 0.01);
break;
+ default:
+ break;
}
break;
}
diff --git a/src/org/traccar/protocol/CellocatorFrameDecoder.java b/src/org/traccar/protocol/CellocatorFrameDecoder.java
index 3be0f5dfe..d4650d966 100644
--- a/src/org/traccar/protocol/CellocatorFrameDecoder.java
+++ b/src/org/traccar/protocol/CellocatorFrameDecoder.java
@@ -19,6 +19,7 @@ import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.frame.FrameDecoder;
+import org.traccar.helper.Log;
public class CellocatorFrameDecoder extends FrameDecoder {
@@ -56,6 +57,9 @@ public class CellocatorFrameDecoder extends FrameDecoder {
case CellocatorProtocolDecoder.MSG_CLIENT_MODULAR:
length = 15 + buf.getUnsignedByte(13);
break;
+ default:
+ Log.warning(new UnsupportedOperationException());
+ break;
}
// Read packet
diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java
index 5e9bb5174..c059d6160 100644
--- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java
@@ -85,6 +85,9 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder {
case 3:
previousFloat = (previousFloat & 0xff000000) + ((buf.readUnsignedMedium() & 0x3fffff) << 2);
break;
+ default:
+ Log.warning(new IllegalArgumentException());
+ break;
}
return Float.intBitsToFloat(previousFloat);
}
diff --git a/src/org/traccar/protocol/TytanProtocolDecoder.java b/src/org/traccar/protocol/TytanProtocolDecoder.java
index be9a9afed..d1fdd99d0 100644
--- a/src/org/traccar/protocol/TytanProtocolDecoder.java
+++ b/src/org/traccar/protocol/TytanProtocolDecoder.java
@@ -174,16 +174,13 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
break;
case 107:
int fuel = buf.readUnsignedShort();
- switch (fuel >> 14) {
- case 1:
- position.set(Event.KEY_FUEL, (fuel & 0x3fff) * 0.4 + "%");
- break;
- case 2:
- position.set(Event.KEY_FUEL, (fuel & 0x3fff) * 0.5 + " l");
- break;
- case 3:
- position.set(Event.KEY_FUEL, (fuel & 0x3fff) * -0.5 + " l");
- break;
+ int fuelFormat = fuel >> 14;
+ if (fuelFormat == 1) {
+ position.set(Event.KEY_FUEL, (fuel & 0x3fff) * 0.4 + "%");
+ } else if (fuelFormat == 2) {
+ position.set(Event.KEY_FUEL, (fuel & 0x3fff) * 0.5 + " l");
+ } else if (fuelFormat == 3) {
+ position.set(Event.KEY_FUEL, (fuel & 0x3fff) * -0.5 + " l");
}
break;
case 108: