diff options
author | Abyss777 <abyss@fox5.ru> | 2017-09-05 08:58:52 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2017-09-05 08:58:52 +0500 |
commit | 158071c9ff74c5435b8f51ea82215240acb69551 (patch) | |
tree | 7f954059b508b4fd96d6976d3cd81ed2728a73f6 | |
parent | 87392d9fbb0289b5486496b6e6b97db1ea84e2b7 (diff) | |
download | traccar-server-158071c9ff74c5435b8f51ea82215240acb69551.tar.gz traccar-server-158071c9ff74c5435b8f51ea82215240acb69551.tar.bz2 traccar-server-158071c9ff74c5435b8f51ea82215240acb69551.zip |
Use casting and remove super
-rw-r--r-- | src/org/traccar/protocol/MiniFinderProtocolEncoder.java | 2 | ||||
-rw-r--r-- | src/org/traccar/protocol/Pt502ProtocolEncoder.java | 4 | ||||
-rw-r--r-- | src/org/traccar/protocol/WatchProtocolEncoder.java | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/MiniFinderProtocolEncoder.java b/src/org/traccar/protocol/MiniFinderProtocolEncoder.java index 7cf19d352..486f406a5 100644 --- a/src/org/traccar/protocol/MiniFinderProtocolEncoder.java +++ b/src/org/traccar/protocol/MiniFinderProtocolEncoder.java @@ -29,7 +29,7 @@ public class MiniFinderProtocolEncoder extends StringProtocolEncoder implements if (key.equals(Command.KEY_ENABLE)) { return (Boolean) value ? "1" : "0"; } else if (key.equals(Command.KEY_TIMEZONE)) { - return String.format("%+03d", TimeZone.getTimeZone(value.toString()).getRawOffset() / 3600000); + return String.format("%+03d", TimeZone.getTimeZone((String) value).getRawOffset() / 3600000); } else if (key.equals(Command.KEY_INDEX)) { switch (((Number) value).intValue()) { case 0: diff --git a/src/org/traccar/protocol/Pt502ProtocolEncoder.java b/src/org/traccar/protocol/Pt502ProtocolEncoder.java index d5e219bd2..4a876f6da 100644 --- a/src/org/traccar/protocol/Pt502ProtocolEncoder.java +++ b/src/org/traccar/protocol/Pt502ProtocolEncoder.java @@ -26,7 +26,7 @@ public class Pt502ProtocolEncoder extends StringProtocolEncoder implements Strin @Override public String formatValue(String key, Object value) { if (key.equals(Command.KEY_TIMEZONE)) { - return String.valueOf(TimeZone.getTimeZone(value.toString()).getRawOffset() / 3600000); + return String.valueOf(TimeZone.getTimeZone((String) value).getRawOffset() / 3600000); } return null; @@ -34,7 +34,7 @@ public class Pt502ProtocolEncoder extends StringProtocolEncoder implements Strin @Override protected String formatCommand(Command command, String format, String... keys) { - return super.formatCommand(command, format, this, keys); + return formatCommand(command, format, this, keys); } @Override diff --git a/src/org/traccar/protocol/WatchProtocolEncoder.java b/src/org/traccar/protocol/WatchProtocolEncoder.java index e585a91c1..d2d3b52d1 100644 --- a/src/org/traccar/protocol/WatchProtocolEncoder.java +++ b/src/org/traccar/protocol/WatchProtocolEncoder.java @@ -33,7 +33,7 @@ public class WatchProtocolEncoder extends StringProtocolEncoder implements Strin @Override public String formatValue(String key, Object value) { if (key.equals(Command.KEY_TIMEZONE)) { - double offset = TimeZone.getTimeZone(value.toString()).getRawOffset() / 3600000.0; + double offset = TimeZone.getTimeZone((String) value).getRawOffset() / 3600000.0; DecimalFormat fmt = new DecimalFormat("+#.##;-#.##", DecimalFormatSymbols.getInstance(Locale.US)); return fmt.format(offset); } @@ -44,7 +44,7 @@ public class WatchProtocolEncoder extends StringProtocolEncoder implements Strin @Override protected String formatCommand(Command command, String format, String... keys) { - String content = super.formatCommand(command, format, this, keys); + String content = formatCommand(command, format, this, keys); return String.format("[CS*%s*%04x*%s]", getUniqueId(command.getDeviceId()), content.length(), content); } |