diff options
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/api/resource/AttributeResource.java | 4 | ||||
-rw-r--r-- | src/org/traccar/database/ExtendedObjectManager.java | 2 | ||||
-rw-r--r-- | src/org/traccar/database/LdapProvider.java | 2 | ||||
-rw-r--r-- | src/org/traccar/database/PermissionsManager.java | 2 | ||||
-rw-r--r-- | src/org/traccar/notification/EventForwarder.java | 2 | ||||
-rw-r--r-- | src/org/traccar/processing/ComputedAttributesHandler.java | 4 | ||||
-rw-r--r-- | src/org/traccar/protocol/TmgFrameDecoder.java | 7 | ||||
-rw-r--r-- | src/org/traccar/reports/Events.java | 2 | ||||
-rw-r--r-- | src/org/traccar/web/CsvBuilder.java | 8 |
9 files changed, 15 insertions, 18 deletions
diff --git a/src/org/traccar/api/resource/AttributeResource.java b/src/org/traccar/api/resource/AttributeResource.java index 26a1f6931..b37cbbeb2 100644 --- a/src/org/traccar/api/resource/AttributeResource.java +++ b/src/org/traccar/api/resource/AttributeResource.java @@ -52,9 +52,9 @@ public class AttributeResource extends ExtendedObjectResource<Attribute> { if (result != null) { switch (entity.getType()) { case "number": - return Response.ok((Number) result).build(); + return Response.ok(result).build(); case "boolean": - return Response.ok((Boolean) result).build(); + return Response.ok(result).build(); default: return Response.ok(result.toString()).build(); } diff --git a/src/org/traccar/database/ExtendedObjectManager.java b/src/org/traccar/database/ExtendedObjectManager.java index 16785cb37..c9e349136 100644 --- a/src/org/traccar/database/ExtendedObjectManager.java +++ b/src/org/traccar/database/ExtendedObjectManager.java @@ -95,7 +95,7 @@ public abstract class ExtendedObjectManager<T extends BaseModel> extends SimpleO long groupId = device.getGroupId(); while (groupId != 0) { getAllDeviceItems(device.getId()).addAll(getGroupItems(groupId)); - Group group = (Group) Context.getGroupsManager().getById(groupId); + Group group = Context.getGroupsManager().getById(groupId); if (group != null) { groupId = group.getGroupId(); } else { diff --git a/src/org/traccar/database/LdapProvider.java b/src/org/traccar/database/LdapProvider.java index 2c4b7ceb1..44dd386ed 100644 --- a/src/org/traccar/database/LdapProvider.java +++ b/src/org/traccar/database/LdapProvider.java @@ -115,7 +115,7 @@ public class LdapProvider { SearchResult searchResult = null; if (results.hasMoreElements()) { - searchResult = (SearchResult) results.nextElement(); + searchResult = results.nextElement(); if (results.hasMoreElements()) { Log.warning("Matched multiple users for the accountName: " + accountName); return null; diff --git a/src/org/traccar/database/PermissionsManager.java b/src/org/traccar/database/PermissionsManager.java index 60bda99ce..3ae5961ce 100644 --- a/src/org/traccar/database/PermissionsManager.java +++ b/src/org/traccar/database/PermissionsManager.java @@ -57,7 +57,7 @@ public class PermissionsManager { } public User getUser(long userId) { - return (User) usersManager.getById(userId); + return usersManager.getById(userId); } public Set<Long> getGroupPermissions(long userId) { diff --git a/src/org/traccar/notification/EventForwarder.java b/src/org/traccar/notification/EventForwarder.java index 68c3ea221..ad8134f18 100644 --- a/src/org/traccar/notification/EventForwarder.java +++ b/src/org/traccar/notification/EventForwarder.java @@ -92,7 +92,7 @@ public abstract class EventForwarder { } } if (event.getGeofenceId() != 0) { - Geofence geofence = (Geofence) Context.getGeofenceManager().getById(event.getGeofenceId()); + Geofence geofence = Context.getGeofenceManager().getById(event.getGeofenceId()); if (geofence != null) { data.put(KEY_GEOFENCE, geofence); } diff --git a/src/org/traccar/processing/ComputedAttributesHandler.java b/src/org/traccar/processing/ComputedAttributesHandler.java index 1e702d17f..f0c54d355 100644 --- a/src/org/traccar/processing/ComputedAttributesHandler.java +++ b/src/org/traccar/processing/ComputedAttributesHandler.java @@ -102,10 +102,10 @@ public class ComputedAttributesHandler extends BaseDataHandler { try { switch (attribute.getType()) { case "number": - position.getAttributes().put(attribute.getAttribute(), (Number) result); + position.getAttributes().put(attribute.getAttribute(), result); break; case "boolean": - position.getAttributes().put(attribute.getAttribute(), (Boolean) result); + position.getAttributes().put(attribute.getAttribute(), result); break; default: position.getAttributes().put(attribute.getAttribute(), result.toString()); diff --git a/src/org/traccar/protocol/TmgFrameDecoder.java b/src/org/traccar/protocol/TmgFrameDecoder.java index 549c42466..c39cf03ac 100644 --- a/src/org/traccar/protocol/TmgFrameDecoder.java +++ b/src/org/traccar/protocol/TmgFrameDecoder.java @@ -37,13 +37,10 @@ public class TmgFrameDecoder extends FrameDecoder { if (buffer.getByte(guessedIndex) != (byte) '$' || buffer.writerIndex() - guessedIndex < 5) { return false; } - if (buffer.getByte(guessedIndex + 4) == ',' + return buffer.getByte(guessedIndex + 4) == ',' && isLetter(buffer.getByte(guessedIndex + 1)) && isLetter(buffer.getByte(guessedIndex + 2)) - && isLetter(buffer.getByte(guessedIndex + 3))) { - return true; - } - return false; + && isLetter(buffer.getByte(guessedIndex + 3)); } }); diff --git a/src/org/traccar/reports/Events.java b/src/org/traccar/reports/Events.java index a13aeeeb4..7cb6ef6eb 100644 --- a/src/org/traccar/reports/Events.java +++ b/src/org/traccar/reports/Events.java @@ -77,7 +77,7 @@ public final class Events { long geofenceId = event.getGeofenceId(); if (geofenceId != 0) { if (Context.getGeofenceManager().checkItemPermission(userId, geofenceId)) { - Geofence geofence = (Geofence) Context.getGeofenceManager().getById(geofenceId); + Geofence geofence = Context.getGeofenceManager().getById(geofenceId); if (geofence != null) { geofenceNames.put(geofenceId, geofence.getName()); } diff --git a/src/org/traccar/web/CsvBuilder.java b/src/org/traccar/web/CsvBuilder.java index 31b389873..2bbe89788 100644 --- a/src/org/traccar/web/CsvBuilder.java +++ b/src/org/traccar/web/CsvBuilder.java @@ -75,16 +75,16 @@ public class CsvBuilder { if (method.getName().startsWith("get") && method.getParameterTypes().length == 0) { try { if (method.getReturnType().equals(boolean.class)) { - builder.append((Boolean) method.invoke(object)); + builder.append(method.invoke(object)); addSeparator(); } else if (method.getReturnType().equals(int.class)) { - builder.append((Integer) method.invoke(object)); + builder.append(method.invoke(object)); addSeparator(); } else if (method.getReturnType().equals(long.class)) { - builder.append((Long) method.invoke(object)); + builder.append(method.invoke(object)); addSeparator(); } else if (method.getReturnType().equals(double.class)) { - builder.append((Double) method.invoke(object)); + builder.append(method.invoke(object)); addSeparator(); } else if (method.getReturnType().equals(String.class)) { builder.append((String) method.invoke(object)); |