aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-01-25 20:02:22 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2018-01-26 08:41:45 +1300
commit8535983fea8c09046c53f2ebf388bbf3fae594ce (patch)
treea9f60c445ea163450b8886f7988853d86088db10 /src/org/traccar
parent1c915fa1360f416ec88f4095664a887ceea2bc15 (diff)
downloadtraccar-server-8535983fea8c09046c53f2ebf388bbf3fae594ce.tar.gz
traccar-server-8535983fea8c09046c53f2ebf388bbf3fae594ce.tar.bz2
traccar-server-8535983fea8c09046c53f2ebf388bbf3fae594ce.zip
Clean up unnecessary code
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/api/resource/AttributeResource.java4
-rw-r--r--src/org/traccar/database/ExtendedObjectManager.java2
-rw-r--r--src/org/traccar/database/LdapProvider.java2
-rw-r--r--src/org/traccar/database/PermissionsManager.java2
-rw-r--r--src/org/traccar/notification/EventForwarder.java2
-rw-r--r--src/org/traccar/processing/ComputedAttributesHandler.java4
-rw-r--r--src/org/traccar/protocol/TmgFrameDecoder.java7
-rw-r--r--src/org/traccar/reports/Events.java2
-rw-r--r--src/org/traccar/web/CsvBuilder.java8
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));