aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-13 11:40:11 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-13 11:40:11 +1300
commita66a9ceda2b87b054136d073a9db440c29810520 (patch)
treee50b2df35af2e4bb20a6d7c1bfca6b40fb350494
parent8d1e3f1f7e35e5bc0c2898ca9c9d840ef9676cd8 (diff)
downloadtraccar-server-a66a9ceda2b87b054136d073a9db440c29810520.tar.gz
traccar-server-a66a9ceda2b87b054136d073a9db440c29810520.tar.bz2
traccar-server-a66a9ceda2b87b054136d073a9db440c29810520.zip
Fix some minor check style issues
-rw-r--r--src/org/traccar/model/MiscFormatter.java5
-rw-r--r--src/org/traccar/protocol/CellocatorFrameDecoder.java5
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolEncoder.java5
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolEncoder.java5
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolEncoder.java4
5 files changed, 20 insertions, 4 deletions
diff --git a/src/org/traccar/model/MiscFormatter.java b/src/org/traccar/model/MiscFormatter.java
index f62e1f42c..2bc6207fb 100644
--- a/src/org/traccar/model/MiscFormatter.java
+++ b/src/org/traccar/model/MiscFormatter.java
@@ -91,7 +91,8 @@ public class MiscFormatter {
Map<String, Object> attributes = new LinkedHashMap<>();
for (Map.Entry<String, JsonValue> entry : json.entrySet()) {
- switch (entry.getValue().getValueType()) {
+ JsonValue.ValueType type = entry.getValue().getValueType();
+ switch (type) {
case STRING:
attributes.put(entry.getKey(), ((JsonString) entry.getValue()).getString());
break;
@@ -110,7 +111,7 @@ public class MiscFormatter {
attributes.put(entry.getKey(), false);
break;
default:
- Log.warning(new IllegalArgumentException());
+ Log.warning(new IllegalArgumentException(type.name()));
break;
}
}
diff --git a/src/org/traccar/protocol/CellocatorFrameDecoder.java b/src/org/traccar/protocol/CellocatorFrameDecoder.java
index d4650d966..c9cfab99e 100644
--- a/src/org/traccar/protocol/CellocatorFrameDecoder.java
+++ b/src/org/traccar/protocol/CellocatorFrameDecoder.java
@@ -39,7 +39,8 @@ public class CellocatorFrameDecoder extends FrameDecoder {
// Size depending on message type
int length = 0;
- switch (buf.getUnsignedByte(4)) {
+ int type = buf.getUnsignedByte(4);
+ switch (type) {
case CellocatorProtocolDecoder.MSG_CLIENT_STATUS:
length = 70;
break;
@@ -58,7 +59,7 @@ public class CellocatorFrameDecoder extends FrameDecoder {
length = 15 + buf.getUnsignedByte(13);
break;
default:
- Log.warning(new UnsupportedOperationException());
+ Log.warning(new UnsupportedOperationException(String.valueOf(type)));
break;
}
diff --git a/src/org/traccar/protocol/Gps103ProtocolEncoder.java b/src/org/traccar/protocol/Gps103ProtocolEncoder.java
index 2b17acb72..b9fb1126e 100644
--- a/src/org/traccar/protocol/Gps103ProtocolEncoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolEncoder.java
@@ -16,6 +16,7 @@
package org.traccar.protocol;
import org.traccar.StringProtocolEncoder;
+import org.traccar.helper.Log;
import org.traccar.model.Command;
public class Gps103ProtocolEncoder extends StringProtocolEncoder implements StringProtocolEncoder.ValueFormatter {
@@ -55,6 +56,10 @@ public class Gps103ProtocolEncoder extends StringProtocolEncoder implements Stri
return formatCommand(command, "**,imei:{%s},L", Command.KEY_UNIQUE_ID);
case Command.TYPE_ALARM_DISARM:
return formatCommand(command, "**,imei:{%s},M", Command.KEY_UNIQUE_ID);
+ default:
+ Log.warning(new UnsupportedOperationException(command.getType()));
+ break;
+
}
return null;
diff --git a/src/org/traccar/protocol/Gt06ProtocolEncoder.java b/src/org/traccar/protocol/Gt06ProtocolEncoder.java
index f518d422d..7c9d921dd 100644
--- a/src/org/traccar/protocol/Gt06ProtocolEncoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolEncoder.java
@@ -19,6 +19,7 @@ import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.traccar.BaseProtocolEncoder;
import org.traccar.helper.Checksum;
+import org.traccar.helper.Log;
import org.traccar.model.Command;
import java.nio.charset.Charset;
@@ -58,6 +59,10 @@ public class Gt06ProtocolEncoder extends BaseProtocolEncoder {
return encodeContent("Relay,1#");
case Command.TYPE_ENGINE_RESUME:
return encodeContent("Relay,0#");
+ default:
+ Log.warning(new UnsupportedOperationException(command.getType()));
+ break;
+
}
return null;
diff --git a/src/org/traccar/protocol/MeitrackProtocolEncoder.java b/src/org/traccar/protocol/MeitrackProtocolEncoder.java
index 06fad3b69..bfda2b7d2 100644
--- a/src/org/traccar/protocol/MeitrackProtocolEncoder.java
+++ b/src/org/traccar/protocol/MeitrackProtocolEncoder.java
@@ -16,6 +16,7 @@
package org.traccar.protocol;
import org.traccar.StringProtocolEncoder;
+import org.traccar.helper.Log;
import org.traccar.model.Command;
public class MeitrackProtocolEncoder extends StringProtocolEncoder {
@@ -32,6 +33,9 @@ public class MeitrackProtocolEncoder extends StringProtocolEncoder {
return formatCommand(command, "@@M33,{%s},C01,0,22122*18\r\n", Command.KEY_UNIQUE_ID);
case Command.TYPE_ALARM_DISARM:
return formatCommand(command, "@@M33,{%s},C01,0,22022*18\r\n", Command.KEY_UNIQUE_ID);
+ default:
+ Log.warning(new UnsupportedOperationException(command.getType()));
+ break;
}
return null;