From 97d57828301ef04ccd4a3c58ca9ce5a23038345e Mon Sep 17 00:00:00 2001 From: Jan-Piet Mens Date: Wed, 19 Jul 2017 12:02:27 +0200 Subject: remove redundant checks --- src/org/traccar/api/resource/DeviceResource.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/org/traccar/api/resource') diff --git a/src/org/traccar/api/resource/DeviceResource.java b/src/org/traccar/api/resource/DeviceResource.java index 0bf0aa45f..2957d623c 100644 --- a/src/org/traccar/api/resource/DeviceResource.java +++ b/src/org/traccar/api/resource/DeviceResource.java @@ -64,18 +64,15 @@ public class DeviceResource extends BaseResource { } ArrayList devices = new ArrayList<>(); - if (!uniqueIds.isEmpty()) { - for (String uniqueId : uniqueIds) { - Device device = Context.getDeviceManager().getDeviceByUniqueId(uniqueId); - Context.getPermissionsManager().checkDevice(getUserId(), device.getId()); - devices.add(device); - } + + for (String uniqueId : uniqueIds) { + Device device = Context.getDeviceManager().getDeviceByUniqueId(uniqueId); + Context.getPermissionsManager().checkDevice(getUserId(), device.getId()); + devices.add(device); } - if (!deviceIds.isEmpty()) { - for (Long deviceId : deviceIds) { - Context.getPermissionsManager().checkDevice(getUserId(), deviceId); - devices.add(Context.getDeviceManager().getDeviceById(deviceId)); - } + for (Long deviceId : deviceIds) { + Context.getPermissionsManager().checkDevice(getUserId(), deviceId); + devices.add(Context.getDeviceManager().getDeviceById(deviceId)); } return devices; } -- cgit v1.2.3