diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-07 14:25:47 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-07 14:25:47 +1300 |
commit | e7bc5f93cd05f27f41bfb25836a04feb511adc17 (patch) | |
tree | fdd2f79116c0403c6bd1fad061b07463379cdc03 /src | |
parent | 2260e9543dc586300b005c97ca83b2902c414968 (diff) | |
download | trackermap-server-e7bc5f93cd05f27f41bfb25836a04feb511adc17.tar.gz trackermap-server-e7bc5f93cd05f27f41bfb25836a04feb511adc17.tar.bz2 trackermap-server-e7bc5f93cd05f27f41bfb25836a04feb511adc17.zip |
Replace more valueOf with parseXxx
Diffstat (limited to 'src')
32 files changed, 248 insertions, 248 deletions
diff --git a/src/org/traccar/protocol/LaipacProtocolDecoder.java b/src/org/traccar/protocol/LaipacProtocolDecoder.java index 825ec1eda..ad425a865 100644 --- a/src/org/traccar/protocol/LaipacProtocolDecoder.java +++ b/src/org/traccar/protocol/LaipacProtocolDecoder.java @@ -82,9 +82,9 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); // Validity String status = parser.group(index++); @@ -109,9 +109,9 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder { position.setCourse(Double.valueOf(parser.group(index++))); // Date - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // Response diff --git a/src/org/traccar/protocol/ManPowerProtocolDecoder.java b/src/org/traccar/protocol/ManPowerProtocolDecoder.java index dc5775581..5bb7e5be9 100644 --- a/src/org/traccar/protocol/ManPowerProtocolDecoder.java +++ b/src/org/traccar/protocol/ManPowerProtocolDecoder.java @@ -80,12 +80,12 @@ public class ManPowerProtocolDecoder extends BaseProtocolDecoder { // Date Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // Validity diff --git a/src/org/traccar/protocol/MaxonProtocolDecoder.java b/src/org/traccar/protocol/MaxonProtocolDecoder.java index 2308e9388..9e4381ee4 100644 --- a/src/org/traccar/protocol/MaxonProtocolDecoder.java +++ b/src/org/traccar/protocol/MaxonProtocolDecoder.java @@ -80,9 +80,9 @@ public class MaxonProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); index += 1; // Skip milliseconds // Validity @@ -113,9 +113,9 @@ public class MaxonProtocolDecoder extends BaseProtocolDecoder { } // Date - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); } else if (sentence.contains("$GPFID") && position != null) { diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java index c07ce38ff..c7ca41dfb 100644 --- a/src/org/traccar/protocol/MegastekProtocolDecoder.java +++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java @@ -85,9 +85,9 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); // Validity position.setValid(parser.group(index++).compareTo("A") == 0); @@ -117,9 +117,9 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { } // Date - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); return true; @@ -207,7 +207,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { String charger = parser.group(index++); if (charger != null) { - position.set(Event.KEY_CHARGE, Integer.valueOf(charger) == 1); + position.set(Event.KEY_CHARGE, Integer.parseInt(charger) == 1); } position.set(Event.KEY_MCC, parser.group(index++)); @@ -313,12 +313,12 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); position.setValid(parser.group(index++).equals("A")); diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java index d2f6985dc..2ef2a388e 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java @@ -221,12 +221,12 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { // Time and date Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // Latitude @@ -246,12 +246,12 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); String mseconds = parser.group(index++); if (mseconds != null) { - time.set(Calendar.MILLISECOND, Integer.valueOf(mseconds)); + time.set(Calendar.MILLISECOND, Integer.parseInt(mseconds)); } // Validity @@ -282,9 +282,9 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { } // Date - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // HDOP diff --git a/src/org/traccar/protocol/MeitrackFrameDecoder.java b/src/org/traccar/protocol/MeitrackFrameDecoder.java index 509e24da2..584b558d0 100644 --- a/src/org/traccar/protocol/MeitrackFrameDecoder.java +++ b/src/org/traccar/protocol/MeitrackFrameDecoder.java @@ -37,7 +37,7 @@ public class MeitrackFrameDecoder extends FrameDecoder { Integer index = ChannelBufferTools.find(buf, buf.readerIndex(), buf.writerIndex(), ","); if (index != null) { - int length = index - buf.readerIndex() + Integer.valueOf(buf.toString(buf.readerIndex() + 3, index - buf.readerIndex() - 3, Charset.defaultCharset())); + int length = index - buf.readerIndex() + Integer.parseInt(buf.toString(buf.readerIndex() + 3, index - buf.readerIndex() - 3, Charset.defaultCharset())); if (buf.readableBytes() >= length) { return buf.readBytes(length); } diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java index 8eabcce42..fc8d67885 100644 --- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java @@ -95,7 +95,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(getDeviceId()); // Event - int event = Integer.valueOf(parser.group(index++)); + int event = Integer.parseInt(parser.group(index++)); position.set(Event.KEY_EVENT, event); // Coordinates @@ -105,12 +105,12 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // Validity diff --git a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java index 12d77e4cc..2f2d96306 100644 --- a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java +++ b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java @@ -79,12 +79,12 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // Location diff --git a/src/org/traccar/protocol/MtxProtocolDecoder.java b/src/org/traccar/protocol/MtxProtocolDecoder.java index edb10aacf..3b8620e2c 100644 --- a/src/org/traccar/protocol/MtxProtocolDecoder.java +++ b/src/org/traccar/protocol/MtxProtocolDecoder.java @@ -84,12 +84,12 @@ public class MtxProtocolDecoder extends BaseProtocolDecoder { // Date Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.YEAR, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.YEAR, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // Location diff --git a/src/org/traccar/protocol/Pt3000ProtocolDecoder.java b/src/org/traccar/protocol/Pt3000ProtocolDecoder.java index 6a037ade0..7cf783a6d 100644 --- a/src/org/traccar/protocol/Pt3000ProtocolDecoder.java +++ b/src/org/traccar/protocol/Pt3000ProtocolDecoder.java @@ -74,9 +74,9 @@ public class Pt3000ProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); // Validity position.setValid(parser.group(index++).compareTo("A") == 0); @@ -106,9 +106,9 @@ public class Pt3000ProtocolDecoder extends BaseProtocolDecoder { } // Date - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); return position; } diff --git a/src/org/traccar/protocol/Pt502ProtocolDecoder.java b/src/org/traccar/protocol/Pt502ProtocolDecoder.java index d2436302d..0349efa59 100644 --- a/src/org/traccar/protocol/Pt502ProtocolDecoder.java +++ b/src/org/traccar/protocol/Pt502ProtocolDecoder.java @@ -82,10 +82,10 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder { // Time
Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
time.clear();
- time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++)));
- time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++)));
- time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++)));
- time.set(Calendar.MILLISECOND, Integer.valueOf(parser.group(index++)));
+ time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++)));
+ time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++)));
+ time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++)));
+ time.set(Calendar.MILLISECOND, Integer.parseInt(parser.group(index++)));
// Validity
position.setValid(parser.group(index++).compareTo("A") == 0);
@@ -119,9 +119,9 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder { }
// Date
- time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++)));
- time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1);
- time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++)));
+ time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++)));
+ time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1);
+ time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++)));
position.setTime(time.getTime());
// IO
diff --git a/src/org/traccar/protocol/RitiProtocolDecoder.java b/src/org/traccar/protocol/RitiProtocolDecoder.java index b46f9df6b..1370d0d73 100644 --- a/src/org/traccar/protocol/RitiProtocolDecoder.java +++ b/src/org/traccar/protocol/RitiProtocolDecoder.java @@ -93,9 +93,9 @@ public class RitiProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); // Validity position.setValid(parser.group(index++).compareTo("A") == 0); @@ -125,9 +125,9 @@ public class RitiProtocolDecoder extends BaseProtocolDecoder { } // Date - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); return position; } diff --git a/src/org/traccar/protocol/SanavProtocolDecoder.java b/src/org/traccar/protocol/SanavProtocolDecoder.java index 5434a983e..9cff7d51c 100644 --- a/src/org/traccar/protocol/SanavProtocolDecoder.java +++ b/src/org/traccar/protocol/SanavProtocolDecoder.java @@ -73,10 +73,10 @@ public class SanavProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MILLISECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MILLISECOND, Integer.parseInt(parser.group(index++))); // Validity position.setValid(parser.group(index++).compareTo("A") == 0); @@ -103,9 +103,9 @@ public class SanavProtocolDecoder extends BaseProtocolDecoder { } // Date - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); return position; } diff --git a/src/org/traccar/protocol/Stl060ProtocolDecoder.java b/src/org/traccar/protocol/Stl060ProtocolDecoder.java index 86e96dfbc..2c9502fae 100644 --- a/src/org/traccar/protocol/Stl060ProtocolDecoder.java +++ b/src/org/traccar/protocol/Stl060ProtocolDecoder.java @@ -95,14 +95,14 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder { // Date Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); // Time - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // Latitude @@ -125,25 +125,25 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder { // Old format if (parser.group(index) != null) { - position.set(Event.KEY_ODOMETER, Integer.valueOf(parser.group(index++))); - position.set(Event.KEY_IGNITION, Integer.valueOf(parser.group(index++))); - position.set(Event.KEY_INPUT, Integer.valueOf(parser.group(index++)) + Integer.valueOf(parser.group(index++)) << 1); - position.set(Event.KEY_FUEL, Integer.valueOf(parser.group(index++))); + position.set(Event.KEY_ODOMETER, Integer.parseInt(parser.group(index++))); + position.set(Event.KEY_IGNITION, Integer.parseInt(parser.group(index++))); + position.set(Event.KEY_INPUT, Integer.parseInt(parser.group(index++)) + Integer.parseInt(parser.group(index++)) << 1); + position.set(Event.KEY_FUEL, Integer.parseInt(parser.group(index++))); } else { index += 5; } // New format if (parser.group(index) != null) { - position.set(Event.KEY_CHARGE, Integer.valueOf(parser.group(index++)) == 1); - position.set(Event.KEY_IGNITION, Integer.valueOf(parser.group(index++))); - position.set(Event.KEY_INPUT, Integer.valueOf(parser.group(index++))); + position.set(Event.KEY_CHARGE, Integer.parseInt(parser.group(index++)) == 1); + position.set(Event.KEY_IGNITION, Integer.parseInt(parser.group(index++))); + position.set(Event.KEY_INPUT, Integer.parseInt(parser.group(index++))); position.set(Event.KEY_RFID, parser.group(index++)); - position.set(Event.KEY_ODOMETER, Integer.valueOf(parser.group(index++))); - position.set(Event.PREFIX_TEMP + 1, Integer.valueOf(parser.group(index++))); - position.set(Event.KEY_FUEL, Integer.valueOf(parser.group(index++))); - position.set("accel", Integer.valueOf(parser.group(index++)) == 1); - position.set(Event.KEY_OUTPUT, Integer.valueOf(parser.group(index++)) + Integer.valueOf(parser.group(index++)) << 1); + position.set(Event.KEY_ODOMETER, Integer.parseInt(parser.group(index++))); + position.set(Event.PREFIX_TEMP + 1, Integer.parseInt(parser.group(index++))); + position.set(Event.KEY_FUEL, Integer.parseInt(parser.group(index++))); + position.set("accel", Integer.parseInt(parser.group(index++)) == 1); + position.set(Event.KEY_OUTPUT, Integer.parseInt(parser.group(index++)) + Integer.parseInt(parser.group(index++)) << 1); } else { index += 10; } diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java index 84f84cdfa..dc77d5750 100644 --- a/src/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java @@ -84,12 +84,12 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { // Date and Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.YEAR, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.YEAR, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // Cell diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java index b67fac903..ce069878a 100644 --- a/src/org/traccar/protocol/T55ProtocolDecoder.java +++ b/src/org/traccar/protocol/T55ProtocolDecoder.java @@ -143,9 +143,9 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); // Validity position.setValid(parser.group(index++).compareTo("A") == 0); @@ -175,9 +175,9 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { } // Date - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); return position; } @@ -200,9 +200,9 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); time.set(Calendar.MILLISECOND, 0); position.setTime(time.getTime()); @@ -290,12 +290,12 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.YEAR, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.YEAR, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // Validity diff --git a/src/org/traccar/protocol/TaipProtocolDecoder.java b/src/org/traccar/protocol/TaipProtocolDecoder.java index 180be3268..0953b739a 100644 --- a/src/org/traccar/protocol/TaipProtocolDecoder.java +++ b/src/org/traccar/protocol/TaipProtocolDecoder.java @@ -141,20 +141,20 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder { String seconds = parser.group(index++); if (seconds != null) { if (week != null && day != null) { - position.setTime(getTime(Integer.valueOf(week), Integer.valueOf(day), Integer.valueOf(seconds))); + position.setTime(getTime(Integer.parseInt(week), Integer.parseInt(day), Integer.parseInt(seconds))); } else { - position.setTime(getTime(Integer.valueOf(seconds))); + position.setTime(getTime(Integer.parseInt(seconds))); } index += 6; } else { Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); } @@ -173,7 +173,7 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder { position.setCourse(Double.valueOf(parser.group(index++))); // Validity - position.setValid(Integer.valueOf(parser.group(index++)) != 0); + position.setValid(Integer.parseInt(parser.group(index++)) != 0); return position; } diff --git a/src/org/traccar/protocol/TelikProtocolDecoder.java b/src/org/traccar/protocol/TelikProtocolDecoder.java index 37edf6d1f..f6b5ebf51 100644 --- a/src/org/traccar/protocol/TelikProtocolDecoder.java +++ b/src/org/traccar/protocol/TelikProtocolDecoder.java @@ -78,12 +78,12 @@ public class TelikProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // Location diff --git a/src/org/traccar/protocol/Tk102ProtocolDecoder.java b/src/org/traccar/protocol/Tk102ProtocolDecoder.java index 7e2dcb6a4..025d91986 100644 --- a/src/org/traccar/protocol/Tk102ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tk102ProtocolDecoder.java @@ -86,9 +86,9 @@ public class Tk102ProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); // Validity position.setValid(parser.group(index++).compareTo("A") == 0); @@ -109,9 +109,9 @@ public class Tk102ProtocolDecoder extends BaseProtocolDecoder { position.setSpeed(Double.valueOf(parser.group(index++))); // Date - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); return position; } diff --git a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java index 5d8ca654e..750611f6c 100644 --- a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java +++ b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java @@ -97,9 +97,9 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); index += 1; // Skip milliseconds // Validity @@ -130,9 +130,9 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder { } // Date - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // Status diff --git a/src/org/traccar/protocol/TopflytechProtocolDecoder.java b/src/org/traccar/protocol/TopflytechProtocolDecoder.java index bd8175a56..aca44a843 100644 --- a/src/org/traccar/protocol/TopflytechProtocolDecoder.java +++ b/src/org/traccar/protocol/TopflytechProtocolDecoder.java @@ -73,12 +73,12 @@ public class TopflytechProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // Validity diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java index 02cad59e9..2d26fdb27 100644 --- a/src/org/traccar/protocol/TotemProtocolDecoder.java +++ b/src/org/traccar/protocol/TotemProtocolDecoder.java @@ -168,14 +168,14 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { time.clear(); int year = 0; if (pattern == pattern2) { - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - year = Integer.valueOf(parser.group(index++)); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + year = Integer.parseInt(parser.group(index++)); time.set(Calendar.YEAR, 2000 + year); } - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); // Validity position.setValid(parser.group(index++).compareTo("A") == 0); @@ -206,9 +206,9 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { // Date if (pattern == pattern1) { - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - year = Integer.valueOf(parser.group(index++)); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + year = Integer.parseInt(parser.group(index++)); time.set(Calendar.YEAR, 2000 + year); } if (year == 0) { @@ -243,12 +243,12 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // IO Status diff --git a/src/org/traccar/protocol/Tr900ProtocolDecoder.java b/src/org/traccar/protocol/Tr900ProtocolDecoder.java index 0af0a8e24..3ac627420 100644 --- a/src/org/traccar/protocol/Tr900ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tr900ProtocolDecoder.java @@ -83,12 +83,12 @@ public class Tr900ProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // Longitude @@ -113,9 +113,9 @@ public class Tr900ProtocolDecoder extends BaseProtocolDecoder { // Other position.set(Event.KEY_GSM, parser.group(index++)); - position.set(Event.KEY_EVENT, Integer.valueOf(parser.group(index++))); - position.set(Event.PREFIX_ADC + 1, Integer.valueOf(parser.group(index++))); - position.set(Event.KEY_BATTERY, Integer.valueOf(parser.group(index++))); + position.set(Event.KEY_EVENT, Integer.parseInt(parser.group(index++))); + position.set(Event.PREFIX_ADC + 1, Integer.parseInt(parser.group(index++))); + position.set(Event.KEY_BATTERY, Integer.parseInt(parser.group(index++))); position.set(Event.KEY_INPUT, parser.group(index++)); position.set(Event.KEY_STATUS, parser.group(index++)); return position; diff --git a/src/org/traccar/protocol/TrackboxProtocolDecoder.java b/src/org/traccar/protocol/TrackboxProtocolDecoder.java index 79abdc5b1..a5093ab0e 100644 --- a/src/org/traccar/protocol/TrackboxProtocolDecoder.java +++ b/src/org/traccar/protocol/TrackboxProtocolDecoder.java @@ -84,10 +84,10 @@ public class TrackboxProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MILLISECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MILLISECOND, Integer.parseInt(parser.group(index++))); // Latitude Double latitude = Double.valueOf(parser.group(index++)); @@ -108,7 +108,7 @@ public class TrackboxProtocolDecoder extends BaseProtocolDecoder { position.setAltitude(Double.valueOf(parser.group(index++))); // Validity - int fix = Integer.valueOf(parser.group(index++)); + int fix = Integer.parseInt(parser.group(index++)); position.set(Event.KEY_GPS, fix); position.setValid(fix > 0); @@ -120,9 +120,9 @@ public class TrackboxProtocolDecoder extends BaseProtocolDecoder { position.setSpeed(Double.valueOf(parser.group(index++))); // Date - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // Satellites diff --git a/src/org/traccar/protocol/V680ProtocolDecoder.java b/src/org/traccar/protocol/V680ProtocolDecoder.java index f24076c9b..f88dea582 100644 --- a/src/org/traccar/protocol/V680ProtocolDecoder.java +++ b/src/org/traccar/protocol/V680ProtocolDecoder.java @@ -91,7 +91,7 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder { position.set("user", parser.group(index++)); // Validity - position.setValid(Integer.valueOf(parser.group(index++)) > 0); + position.setValid(Integer.parseInt(parser.group(index++)) > 0); // Password position.set("password", parser.group(index++)); @@ -129,19 +129,19 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder { // Date Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - int day = Integer.valueOf(parser.group(index++)); - int month = Integer.valueOf(parser.group(index++)); + int day = Integer.parseInt(parser.group(index++)); + int month = Integer.parseInt(parser.group(index++)); if (day == 0 && month == 0) { return null; // invalid date } time.set(Calendar.DAY_OF_MONTH, day); time.set(Calendar.MONTH, month - 1); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); // Time - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); return position; } diff --git a/src/org/traccar/protocol/VisiontekProtocolDecoder.java b/src/org/traccar/protocol/VisiontekProtocolDecoder.java index d09673f00..a491e7666 100644 --- a/src/org/traccar/protocol/VisiontekProtocolDecoder.java +++ b/src/org/traccar/protocol/VisiontekProtocolDecoder.java @@ -85,12 +85,12 @@ public class VisiontekProtocolDecoder extends BaseProtocolDecoder { // Date Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // Latitude diff --git a/src/org/traccar/protocol/WialonProtocolDecoder.java b/src/org/traccar/protocol/WialonProtocolDecoder.java index ef6ebeab8..61748731a 100644 --- a/src/org/traccar/protocol/WialonProtocolDecoder.java +++ b/src/org/traccar/protocol/WialonProtocolDecoder.java @@ -85,12 +85,12 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder { // Date and Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // Latitude @@ -126,7 +126,7 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder { // Satellites String satellites = parser.group(index++); if (satellites != null) { - position.setValid(Integer.valueOf(satellites) >= 3); + position.setValid(Integer.parseInt(satellites) >= 3); position.set(Event.KEY_SATELLITES, satellites); } else { position.setValid(false); diff --git a/src/org/traccar/protocol/WondexProtocolDecoder.java b/src/org/traccar/protocol/WondexProtocolDecoder.java index 2a3d43b5b..cd95e8463 100644 --- a/src/org/traccar/protocol/WondexProtocolDecoder.java +++ b/src/org/traccar/protocol/WondexProtocolDecoder.java @@ -78,12 +78,12 @@ public class WondexProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.YEAR, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.YEAR, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // Position data @@ -94,7 +94,7 @@ public class WondexProtocolDecoder extends BaseProtocolDecoder { position.setAltitude(Double.valueOf(parser.group(index++))); // Satellites - int satellites = Integer.valueOf(parser.group(index++)); + int satellites = Integer.parseInt(parser.group(index++)); position.setValid(satellites >= 3); position.set(Event.KEY_SATELLITES, satellites); diff --git a/src/org/traccar/protocol/XexunProtocolDecoder.java b/src/org/traccar/protocol/XexunProtocolDecoder.java index 84ff44332..59ac630f1 100644 --- a/src/org/traccar/protocol/XexunProtocolDecoder.java +++ b/src/org/traccar/protocol/XexunProtocolDecoder.java @@ -87,10 +87,10 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MILLISECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MILLISECOND, Integer.parseInt(parser.group(index++))); // Validity position.setValid(parser.group(index++).compareTo("A") == 0); @@ -120,9 +120,9 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder { } // Date - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // Signal diff --git a/src/org/traccar/protocol/XirgoProtocolDecoder.java b/src/org/traccar/protocol/XirgoProtocolDecoder.java index 8e070694f..f6ae4776b 100644 --- a/src/org/traccar/protocol/XirgoProtocolDecoder.java +++ b/src/org/traccar/protocol/XirgoProtocolDecoder.java @@ -81,12 +81,12 @@ public class XirgoProtocolDecoder extends BaseProtocolDecoder { // Date Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.YEAR, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.YEAR, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // Location @@ -104,7 +104,7 @@ public class XirgoProtocolDecoder extends BaseProtocolDecoder { position.set(Event.KEY_ODOMETER, parser.group(index++)); // Validity - position.setValid(Integer.valueOf(parser.group(index++)) == 1); + position.setValid(Integer.parseInt(parser.group(index++)) == 1); return position; } diff --git a/src/org/traccar/protocol/Xt013ProtocolDecoder.java b/src/org/traccar/protocol/Xt013ProtocolDecoder.java index a35318532..69b259ba8 100644 --- a/src/org/traccar/protocol/Xt013ProtocolDecoder.java +++ b/src/org/traccar/protocol/Xt013ProtocolDecoder.java @@ -84,12 +84,12 @@ public class Xt013ProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // Location diff --git a/src/org/traccar/protocol/YwtProtocolDecoder.java b/src/org/traccar/protocol/YwtProtocolDecoder.java index c2d3058aa..85c7465e3 100644 --- a/src/org/traccar/protocol/YwtProtocolDecoder.java +++ b/src/org/traccar/protocol/YwtProtocolDecoder.java @@ -94,12 +94,12 @@ public class YwtProtocolDecoder extends BaseProtocolDecoder { // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); - time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); + time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++))); + time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1); + time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++))); + time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++))); + time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++))); + time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++))); position.setTime(time.getTime()); // Longitude @@ -127,7 +127,7 @@ public class YwtProtocolDecoder extends BaseProtocolDecoder { position.setCourse(Double.valueOf(parser.group(index++))); // Satellites - int satellites = Integer.valueOf(parser.group(index++)); + int satellites = Integer.parseInt(parser.group(index++)); position.setValid(satellites >= 3); position.set(Event.KEY_SATELLITES, satellites); |