aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-07 14:19:28 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-07 14:19:28 +1300
commit2260e9543dc586300b005c97ca83b2902c414968 (patch)
tree0ac295e51c084fae971684f5e5ac114ebc733f09 /src/org
parent83382e14d92cadaa40c62d07cdba05a6ded5af83 (diff)
downloadtrackermap-server-2260e9543dc586300b005c97ca83b2902c414968.tar.gz
trackermap-server-2260e9543dc586300b005c97ca83b2902c414968.tar.bz2
trackermap-server-2260e9543dc586300b005c97ca83b2902c414968.zip
Replace valueOf with parseXxx calls
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/helper/ChannelBufferTools.java2
-rw-r--r--src/org/traccar/protocol/Ev603ProtocolDecoder.java12
-rw-r--r--src/org/traccar/protocol/FlextrackProtocolDecoder.java12
-rw-r--r--src/org/traccar/protocol/FreedomProtocolDecoder.java12
-rw-r--r--src/org/traccar/protocol/Gl100ProtocolDecoder.java19
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java14
-rw-r--r--src/org/traccar/protocol/GlobalSatProtocolDecoder.java32
-rw-r--r--src/org/traccar/protocol/GoSafeProtocolDecoder.java12
-rw-r--r--src/org/traccar/protocol/GotopProtocolDecoder.java12
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java18
-rw-r--r--src/org/traccar/protocol/GpsGateProtocolDecoder.java16
-rw-r--r--src/org/traccar/protocol/GpsMarkerProtocolDecoder.java12
-rw-r--r--src/org/traccar/protocol/H02ProtocolDecoder.java12
-rw-r--r--src/org/traccar/protocol/HaicomProtocolDecoder.java14
-rw-r--r--src/org/traccar/protocol/IntellitracProtocolDecoder.java17
-rw-r--r--src/org/traccar/protocol/Jt600ProtocolDecoder.java14
-rw-r--r--src/org/traccar/protocol/KhdProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/OsmAndProtocolDecoder.java2
-rw-r--r--src/org/traccar/web/AsyncServlet.java2
-rw-r--r--src/org/traccar/web/PositionServlet.java2
21 files changed, 120 insertions, 120 deletions
diff --git a/src/org/traccar/helper/ChannelBufferTools.java b/src/org/traccar/helper/ChannelBufferTools.java
index 75c16ae50..e9cd21724 100644
--- a/src/org/traccar/helper/ChannelBufferTools.java
+++ b/src/org/traccar/helper/ChannelBufferTools.java
@@ -140,7 +140,7 @@ public class ChannelBufferTools {
int count = in.length() / 2;
byte[] out = new byte[count];
for (int i = 0; i < count; i++) {
- out[i] = Integer.valueOf(in.substring(i * 2, (i + 1) * 2), 16).byteValue();
+ out[i] = (byte) Integer.parseInt(in.substring(i * 2, (i + 1) * 2), 16);
}
return out;
}
diff --git a/src/org/traccar/protocol/Ev603ProtocolDecoder.java b/src/org/traccar/protocol/Ev603ProtocolDecoder.java
index a15e68f86..31c0a8208 100644
--- a/src/org/traccar/protocol/Ev603ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Ev603ProtocolDecoder.java
@@ -71,14 +71,14 @@ public class Ev603ProtocolDecoder 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());
// Validity
diff --git a/src/org/traccar/protocol/FlextrackProtocolDecoder.java b/src/org/traccar/protocol/FlextrackProtocolDecoder.java
index ec0f0a05c..6840ba30f 100644
--- a/src/org/traccar/protocol/FlextrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/FlextrackProtocolDecoder.java
@@ -112,12 +112,12 @@ public class FlextrackProtocolDecoder 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());
// Latitude
diff --git a/src/org/traccar/protocol/FreedomProtocolDecoder.java b/src/org/traccar/protocol/FreedomProtocolDecoder.java
index d909d4426..bcb271bf9 100644
--- a/src/org/traccar/protocol/FreedomProtocolDecoder.java
+++ b/src/org/traccar/protocol/FreedomProtocolDecoder.java
@@ -70,12 +70,12 @@ public class FreedomProtocolDecoder 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());
// Latitude
diff --git a/src/org/traccar/protocol/Gl100ProtocolDecoder.java b/src/org/traccar/protocol/Gl100ProtocolDecoder.java
index 6756cc972..b49f9af9e 100644
--- a/src/org/traccar/protocol/Gl100ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl100ProtocolDecoder.java
@@ -84,7 +84,7 @@ public class Gl100ProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
// Validity
- position.setValid(Integer.valueOf(parser.group(index++)) == 0);
+ position.setValid(Integer.parseInt(parser.group(index++)) == 0);
// Position info
position.setSpeed(Double.valueOf(parser.group(index++)));
@@ -93,18 +93,17 @@ public class Gl100ProtocolDecoder extends BaseProtocolDecoder {
position.setLongitude(Double.valueOf(parser.group(index++)));
position.setLatitude(Double.valueOf(parser.group(index++)));
- // Date
+ // 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
- 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());
+
return position;
}
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index 61a0aed39..0a9ff86ea 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -133,7 +133,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_OBD_ODOMETER, parser.group(index++));
// Validity
- position.setValid(Integer.valueOf(parser.group(index++)) < 20);
+ position.setValid(Integer.parseInt(parser.group(index++)) < 20);
// Speed
String speed = parser.group(index++);
@@ -160,14 +160,14 @@ public class Gl200ProtocolDecoder 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.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
- 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());
// Cell information
diff --git a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
index e652d932b..ea5e6bcc0 100644
--- a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
+++ b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
@@ -96,19 +96,19 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder {
if (value.isEmpty()) {
position.setValid(false);
} else {
- position.setValid(Integer.valueOf(value) != 1);
+ position.setValid(Integer.parseInt(value) != 1);
}
break;
case 'B':
Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
time.clear();
- time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(value.substring(0, 2)));
- time.set(Calendar.MONTH, Integer.valueOf(value.substring(2, 4)) - 1);
- time.set(Calendar.YEAR, 2000 + Integer.valueOf(value.substring(4)));
+ time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(value.substring(0, 2)));
+ time.set(Calendar.MONTH, Integer.parseInt(value.substring(2, 4)) - 1);
+ time.set(Calendar.YEAR, 2000 + Integer.parseInt(value.substring(4)));
value = values[++valueIndex];
- time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(value.substring(0, 2)));
- time.set(Calendar.MINUTE, Integer.valueOf(value.substring(2, 4)));
- time.set(Calendar.SECOND, Integer.valueOf(value.substring(4)));
+ time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(value.substring(0, 2)));
+ time.set(Calendar.MINUTE, Integer.parseInt(value.substring(2, 4)));
+ time.set(Calendar.SECOND, Integer.parseInt(value.substring(4)));
position.setTime(time.getTime());
break;
case 'C':
@@ -121,7 +121,7 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder {
break;
case '2':
longitude = Double.valueOf(value.substring(4)) / 60;
- longitude += Integer.valueOf(value.substring(1, 4));
+ longitude += Integer.parseInt(value.substring(1, 4));
if (value.charAt(0) == 'W') longitude = -longitude;
position.setLongitude(longitude);
break;
@@ -135,7 +135,7 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder {
break;
case '7':
latitude = Double.valueOf(value.substring(3)) / 60;
- latitude += Integer.valueOf(value.substring(1, 3));
+ latitude += Integer.parseInt(value.substring(1, 3));
if (value.charAt(0) == 'S') latitude = -latitude;
position.setLatitude(latitude);
break;
@@ -212,12 +212,12 @@ public class GlobalSatProtocolDecoder 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());
// Longitude
@@ -244,7 +244,7 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(Double.valueOf(parser.group(index++)));
// Satellites
- position.set(Event.KEY_SATELLITES, Integer.valueOf(parser.group(index++)));
+ position.set(Event.KEY_SATELLITES, Integer.parseInt(parser.group(index++)));
// HDOP
position.set(Event.KEY_HDOP, parser.group(index++));
diff --git a/src/org/traccar/protocol/GoSafeProtocolDecoder.java b/src/org/traccar/protocol/GoSafeProtocolDecoder.java
index 8e2215405..ddb4af6b7 100644
--- a/src/org/traccar/protocol/GoSafeProtocolDecoder.java
+++ b/src/org/traccar/protocol/GoSafeProtocolDecoder.java
@@ -79,12 +79,12 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder {
// 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());
// Validity
diff --git a/src/org/traccar/protocol/GotopProtocolDecoder.java b/src/org/traccar/protocol/GotopProtocolDecoder.java
index a71dfd7eb..52a864a5a 100644
--- a/src/org/traccar/protocol/GotopProtocolDecoder.java
+++ b/src/org/traccar/protocol/GotopProtocolDecoder.java
@@ -76,12 +76,12 @@ public class GotopProtocolDecoder 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());
// Latitude
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index 9936a064a..4a576b646 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -116,12 +116,12 @@ public class Gps103ProtocolDecoder 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.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++)));
- int localHours = Integer.valueOf(parser.group(index++));
- int localMinutes = Integer.valueOf(parser.group(index++));
+ int localHours = Integer.parseInt(parser.group(index++));
+ int localMinutes = Integer.parseInt(parser.group(index++));
String utcHours = parser.group(index++);
String utcMinutes = parser.group(index++);
@@ -131,17 +131,17 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
time.set(Calendar.MINUTE, localMinutes);
String seconds = parser.group(index++);
if (seconds != null) {
- time.set(Calendar.SECOND, Integer.valueOf(seconds));
+ time.set(Calendar.SECOND, Integer.parseInt(seconds));
}
String milliseconds = parser.group(index++);
if (milliseconds != null) {
- time.set(Calendar.MILLISECOND, Integer.valueOf(milliseconds));
+ time.set(Calendar.MILLISECOND, Integer.parseInt(milliseconds));
}
// Timezone calculation
if (utcHours != null && utcMinutes != null) {
- int deltaMinutes = (localHours - Integer.valueOf(utcHours)) * 60;
- deltaMinutes += localMinutes - Integer.valueOf(utcMinutes);
+ int deltaMinutes = (localHours - Integer.parseInt(utcHours)) * 60;
+ deltaMinutes += localMinutes - Integer.parseInt(utcMinutes);
if (deltaMinutes <= -12 * 60) {
deltaMinutes += 24 * 60;
} else if (deltaMinutes > 12 * 60) {
diff --git a/src/org/traccar/protocol/GpsGateProtocolDecoder.java b/src/org/traccar/protocol/GpsGateProtocolDecoder.java
index 729a824cc..d45246b0c 100644
--- a/src/org/traccar/protocol/GpsGateProtocolDecoder.java
+++ b/src/org/traccar/protocol/GpsGateProtocolDecoder.java
@@ -35,7 +35,7 @@ public class GpsGateProtocolDecoder extends BaseProtocolDecoder {
private static final Pattern pattern = Pattern.compile(
"\\$GPRMC," +
- "(\\d{2})(\\d{2})(\\d{2})\\.?(\\d+)?," + // Time (HHMMSS.SSS)
+ "(\\d{2})(\\d{2})(\\d{2})\\.?(?:\\d+)?," + // Time (HHMMSS.SSS)
"([AV])," + // Validity
"(\\d{2})(\\d{2}\\.\\d+)," + // Latitude (DDMM.MMMM)
"([NS])," +
@@ -106,10 +106,9 @@ public class GpsGateProtocolDecoder 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++)));
- index += 1; // Skip milliseconds
+ 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);
@@ -139,10 +138,11 @@ public class GpsGateProtocolDecoder 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/GpsMarkerProtocolDecoder.java b/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java
index 2b2f286c0..aaab9fecc 100644
--- a/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java
+++ b/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java
@@ -80,14 +80,14 @@ public class GpsMarkerProtocolDecoder 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.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++)));
String seconds = parser.group(index++);
if (seconds != null) {
- time.set(Calendar.SECOND, Integer.valueOf(seconds));
+ time.set(Calendar.SECOND, Integer.parseInt(seconds));
}
position.setTime(time.getTime());
diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java
index 30193a648..2fd05ad2d 100644
--- a/src/org/traccar/protocol/H02ProtocolDecoder.java
+++ b/src/org/traccar/protocol/H02ProtocolDecoder.java
@@ -146,9 +146,9 @@ public class H02ProtocolDecoder 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 valid = parser.group(index++);
@@ -178,9 +178,9 @@ public class H02ProtocolDecoder 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());
processStatus(position, Long.parseLong(parser.group(index++), 16));
diff --git a/src/org/traccar/protocol/HaicomProtocolDecoder.java b/src/org/traccar/protocol/HaicomProtocolDecoder.java
index 3062c72d5..911479bbb 100644
--- a/src/org/traccar/protocol/HaicomProtocolDecoder.java
+++ b/src/org/traccar/protocol/HaicomProtocolDecoder.java
@@ -83,16 +83,16 @@ public class HaicomProtocolDecoder 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
- int flags = Integer.valueOf(parser.group(index++));
+ int flags = Integer.parseInt(parser.group(index++));
position.setValid((flags & 0x1) != 0);
// Latitude
diff --git a/src/org/traccar/protocol/IntellitracProtocolDecoder.java b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
index 052e7a508..fd393da45 100644
--- a/src/org/traccar/protocol/IntellitracProtocolDecoder.java
+++ b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
@@ -88,12 +88,12 @@ public class IntellitracProtocolDecoder 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());
// Location data
@@ -104,12 +104,12 @@ public class IntellitracProtocolDecoder 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);
// Report identifier
- position.set(Event.KEY_INDEX, Long.valueOf(parser.group(index++)));
+ position.set(Event.KEY_INDEX, Long.parseLong(parser.group(index++)));
// Input
position.set(Event.KEY_INPUT, parser.group(index++));
@@ -132,6 +132,7 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder {
position.set("tpl", parser.group(index++));
position.set("axle", parser.group(index++));
position.set(Event.KEY_ODOMETER, parser.group(index++));
+
return position;
}
diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
index e6c75ef9d..c2d86391e 100644
--- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
@@ -44,7 +44,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
buf.readByte(); // header
// Get device by identifier
- String id = Long.valueOf(ChannelBufferTools.readHexString(buf, 10)).toString();
+ String id = String.valueOf(Long.parseLong(ChannelBufferTools.readHexString(buf, 10)));
if (!identify(id, channel)) {
return null;
}
@@ -180,12 +180,12 @@ public class Jt600ProtocolDecoder 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());
// Speed
diff --git a/src/org/traccar/protocol/KhdProtocolDecoder.java b/src/org/traccar/protocol/KhdProtocolDecoder.java
index 9e3249a7a..e934cacf3 100644
--- a/src/org/traccar/protocol/KhdProtocolDecoder.java
+++ b/src/org/traccar/protocol/KhdProtocolDecoder.java
@@ -42,7 +42,7 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder {
int b3 = buf.readUnsignedByte(); if (b3 > 0x80) b3 -= 0x80;
int b4 = buf.readUnsignedByte();
String serialNumber = String.format("%02d%02d%02d%02d", b1, b2, b3, b4);
- return String.valueOf(Long.valueOf(serialNumber));
+ return String.valueOf(Long.parseLong(serialNumber));
}
private static final int MSG_LOGIN = 0xB1;
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index a7d8a884e..d2f6985dc 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -100,7 +100,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
if (id.length() == 14) {
// Try to recreate full IMEI number
// Sometimes first digit is cut, so this won't work
- if (identify(id + Checksum.luhn(Long.valueOf(id)), channel, null, false)) {
+ if (identify(id + Checksum.luhn(Long.parseLong(id)), channel, null, false)) {
return true;
}
}
diff --git a/src/org/traccar/protocol/OsmAndProtocolDecoder.java b/src/org/traccar/protocol/OsmAndProtocolDecoder.java
index 47f96b32a..ecc1e1b18 100644
--- a/src/org/traccar/protocol/OsmAndProtocolDecoder.java
+++ b/src/org/traccar/protocol/OsmAndProtocolDecoder.java
@@ -69,7 +69,7 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder {
position.setValid(true);
if (params.containsKey("timestamp")) {
try {
- long timestamp = Long.valueOf(params.get("timestamp").get(0));
+ long timestamp = Long.parseLong(params.get("timestamp").get(0));
if (timestamp < Integer.MAX_VALUE) {
timestamp *= 1000;
}
diff --git a/src/org/traccar/web/AsyncServlet.java b/src/org/traccar/web/AsyncServlet.java
index f9217aefe..eaab7abe8 100644
--- a/src/org/traccar/web/AsyncServlet.java
+++ b/src/org/traccar/web/AsyncServlet.java
@@ -203,7 +203,7 @@ public class AsyncServlet extends BaseServlet {
synchronized (asyncSessions) {
- if (Boolean.valueOf(req.getParameter("first")) || !asyncSessions.containsKey(userId)) {
+ if (Boolean.parseBoolean(req.getParameter("first")) || !asyncSessions.containsKey(userId)) {
Collection<Long> devices = Context.getPermissionsManager().allowedDevices(userId);
asyncSessions.put(userId, new AsyncSession(userId, devices));
}
diff --git a/src/org/traccar/web/PositionServlet.java b/src/org/traccar/web/PositionServlet.java
index 5ed74102f..afd7bab2a 100644
--- a/src/org/traccar/web/PositionServlet.java
+++ b/src/org/traccar/web/PositionServlet.java
@@ -43,7 +43,7 @@ public class PositionServlet extends BaseServlet {
}
private void get(HttpServletRequest req, HttpServletResponse resp) throws Exception {
- long deviceId = Long.valueOf(req.getParameter("deviceId"));
+ long deviceId = Long.parseLong(req.getParameter("deviceId"));
Context.getPermissionsManager().checkDevice(getUserId(req), deviceId);
sendResponse(resp.getWriter(), JsonConverter.arrayToJson(
Context.getDataManager().getPositions(