From ef5f959f737a6277b146e5eb4e34827638b1f93c Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 30 Sep 2020 23:06:59 -0700 Subject: Various minor code cleanup --- src/main/java/org/traccar/BasePipelineFactory.java | 2 +- src/main/java/org/traccar/BaseProtocolDecoder.java | 2 +- src/main/java/org/traccar/WebDataHandler.java | 2 +- src/main/java/org/traccar/WindowsService.java | 24 ++--- .../java/org/traccar/WrapperInboundHandler.java | 2 +- .../java/org/traccar/WrapperOutboundHandler.java | 2 +- src/main/java/org/traccar/api/AsyncSocket.java | 2 +- .../java/org/traccar/api/BaseObjectResource.java | 2 +- src/main/java/org/traccar/api/UserPrincipal.java | 4 +- .../org/traccar/api/resource/DeviceResource.java | 2 +- .../org/traccar/api/resource/UserResource.java | 2 +- .../org/traccar/database/BaseObjectManager.java | 2 +- .../java/org/traccar/database/CommandsManager.java | 2 +- .../java/org/traccar/database/DataManager.java | 2 +- .../java/org/traccar/database/DeviceManager.java | 4 +- .../org/traccar/database/PermissionsManager.java | 2 +- .../java/org/traccar/database/QueryBuilder.java | 116 ++++++++------------- .../java/org/traccar/geofence/GeofenceCircle.java | 2 +- src/main/java/org/traccar/helper/BitBuffer.java | 2 +- src/main/java/org/traccar/helper/Checksum.java | 12 +-- src/main/java/org/traccar/helper/DateBuilder.java | 2 +- src/main/java/org/traccar/helper/Parser.java | 2 +- .../traccar/protocol/OwnTracksProtocolDecoder.java | 6 +- src/main/java/org/traccar/reports/ReportUtils.java | 3 +- 24 files changed, 86 insertions(+), 117 deletions(-) diff --git a/src/main/java/org/traccar/BasePipelineFactory.java b/src/main/java/org/traccar/BasePipelineFactory.java index c038c1f92..ffce45342 100644 --- a/src/main/java/org/traccar/BasePipelineFactory.java +++ b/src/main/java/org/traccar/BasePipelineFactory.java @@ -59,7 +59,7 @@ public abstract class BasePipelineFactory extends ChannelInitializer { private final TrackerServer server; private final String protocol; - private boolean eventsEnabled; + private final boolean eventsEnabled; private int timeout; public BasePipelineFactory(TrackerServer server, String protocol) { diff --git a/src/main/java/org/traccar/BaseProtocolDecoder.java b/src/main/java/org/traccar/BaseProtocolDecoder.java index 99f3bc627..50e80a457 100644 --- a/src/main/java/org/traccar/BaseProtocolDecoder.java +++ b/src/main/java/org/traccar/BaseProtocolDecoder.java @@ -104,7 +104,7 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder { } private DeviceSession channelDeviceSession; // connection-based protocols - private Map addressDeviceSessions = new HashMap<>(); // connectionless protocols + private final Map addressDeviceSessions = new HashMap<>(); // connectionless protocols private long findDeviceId(SocketAddress remoteAddress, String... uniqueIds) { if (uniqueIds.length > 0) { diff --git a/src/main/java/org/traccar/WebDataHandler.java b/src/main/java/org/traccar/WebDataHandler.java index b3b83a9cf..a7ea0b2a5 100644 --- a/src/main/java/org/traccar/WebDataHandler.java +++ b/src/main/java/org/traccar/WebDataHandler.java @@ -74,7 +74,7 @@ public class WebDataHandler extends BaseDataHandler { private final int retryCount; private final int retryLimit; - private AtomicInteger deliveryPending; + private final AtomicInteger deliveryPending; @Inject public WebDataHandler( diff --git a/src/main/java/org/traccar/WindowsService.java b/src/main/java/org/traccar/WindowsService.java index 4a8955608..831cd3ebc 100644 --- a/src/main/java/org/traccar/WindowsService.java +++ b/src/main/java/org/traccar/WindowsService.java @@ -38,16 +38,14 @@ public abstract class WindowsService { private final Object waitObject = new Object(); - private String serviceName; - private ServiceMain serviceMain; - private ServiceControl serviceControl; + private final String serviceName; private SERVICE_STATUS_HANDLE serviceStatusHandle; public WindowsService(String serviceName) { this.serviceName = serviceName; } - public boolean install( + public void install( String displayName, String description, String[] dependencies, String account, String password, String config) throws URISyntaxException { @@ -60,7 +58,6 @@ public abstract class WindowsService { + " -jar \"" + jar.getAbsolutePath() + "\"" + " --service \"" + config + "\""; - boolean success = false; StringBuilder dep = new StringBuilder(); if (dependencies != null) { @@ -84,29 +81,25 @@ public abstract class WindowsService { null, null, dep.toString(), account, password); if (service != null) { - success = ADVAPI_32.ChangeServiceConfig2(service, Winsvc.SERVICE_CONFIG_DESCRIPTION, desc); + ADVAPI_32.ChangeServiceConfig2(service, Winsvc.SERVICE_CONFIG_DESCRIPTION, desc); ADVAPI_32.CloseServiceHandle(service); } ADVAPI_32.CloseServiceHandle(serviceManager); } - return success; } - public boolean uninstall() { - boolean success = false; - + public void uninstall() { SC_HANDLE serviceManager = openServiceControlManager(null, Winsvc.SC_MANAGER_ALL_ACCESS); if (serviceManager != null) { SC_HANDLE service = ADVAPI_32.OpenService(serviceManager, serviceName, Winsvc.SERVICE_ALL_ACCESS); if (service != null) { - success = ADVAPI_32.DeleteService(service); + ADVAPI_32.DeleteService(service); ADVAPI_32.CloseServiceHandle(service); } ADVAPI_32.CloseServiceHandle(serviceManager); } - return success; } public boolean start() { @@ -152,7 +145,7 @@ public abstract class WindowsService { POSIXFactory.getPOSIX().chdir(path); - serviceMain = new ServiceMain(); + ServiceMain serviceMain = new ServiceMain(); SERVICE_TABLE_ENTRY entry = new SERVICE_TABLE_ENTRY(); entry.lpServiceName = serviceName; entry.lpServiceProc = serviceMain; @@ -180,7 +173,7 @@ public abstract class WindowsService { private class ServiceMain implements SERVICE_MAIN_FUNCTION { public void callback(int dwArgc, Pointer lpszArgv) { - serviceControl = new ServiceControl(); + ServiceControl serviceControl = new ServiceControl(); serviceStatusHandle = ADVAPI_32.RegisterServiceCtrlHandlerEx(serviceName, serviceControl, null); reportStatus(Winsvc.SERVICE_START_PENDING, WinError.NO_ERROR, 3000); @@ -194,7 +187,8 @@ public abstract class WindowsService { synchronized (waitObject) { waitObject.wait(); } - } catch (InterruptedException ex) { + } catch (InterruptedException e) { + e.printStackTrace(); } reportStatus(Winsvc.SERVICE_STOPPED, WinError.NO_ERROR, 0); diff --git a/src/main/java/org/traccar/WrapperInboundHandler.java b/src/main/java/org/traccar/WrapperInboundHandler.java index ca33d021f..5e2b1d304 100644 --- a/src/main/java/org/traccar/WrapperInboundHandler.java +++ b/src/main/java/org/traccar/WrapperInboundHandler.java @@ -20,7 +20,7 @@ import io.netty.channel.ChannelInboundHandler; public class WrapperInboundHandler implements ChannelInboundHandler { - private ChannelInboundHandler handler; + private final ChannelInboundHandler handler; public ChannelInboundHandler getWrappedHandler() { return handler; diff --git a/src/main/java/org/traccar/WrapperOutboundHandler.java b/src/main/java/org/traccar/WrapperOutboundHandler.java index 0136c5b22..ae2b06ad2 100644 --- a/src/main/java/org/traccar/WrapperOutboundHandler.java +++ b/src/main/java/org/traccar/WrapperOutboundHandler.java @@ -23,7 +23,7 @@ import java.net.SocketAddress; public class WrapperOutboundHandler implements ChannelOutboundHandler { - private ChannelOutboundHandler handler; + private final ChannelOutboundHandler handler; public ChannelOutboundHandler getWrappedHandler() { return handler; diff --git a/src/main/java/org/traccar/api/AsyncSocket.java b/src/main/java/org/traccar/api/AsyncSocket.java index 906d16b5b..b2ff5031a 100644 --- a/src/main/java/org/traccar/api/AsyncSocket.java +++ b/src/main/java/org/traccar/api/AsyncSocket.java @@ -39,7 +39,7 @@ public class AsyncSocket extends WebSocketAdapter implements ConnectionManager.U private static final String KEY_POSITIONS = "positions"; private static final String KEY_EVENTS = "events"; - private long userId; + private final long userId; public AsyncSocket(long userId) { this.userId = userId; diff --git a/src/main/java/org/traccar/api/BaseObjectResource.java b/src/main/java/org/traccar/api/BaseObjectResource.java index c4206f385..bc7d3c466 100644 --- a/src/main/java/org/traccar/api/BaseObjectResource.java +++ b/src/main/java/org/traccar/api/BaseObjectResource.java @@ -44,7 +44,7 @@ import org.traccar.model.User; public abstract class BaseObjectResource extends BaseResource { - private Class baseClass; + private final Class baseClass; public BaseObjectResource(Class baseClass) { this.baseClass = baseClass; diff --git a/src/main/java/org/traccar/api/UserPrincipal.java b/src/main/java/org/traccar/api/UserPrincipal.java index 80e92c2dd..175bca391 100644 --- a/src/main/java/org/traccar/api/UserPrincipal.java +++ b/src/main/java/org/traccar/api/UserPrincipal.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Anton Tananaev (anton@traccar.org) + * Copyright 2015 - 2020 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ import java.security.Principal; public class UserPrincipal implements Principal { - private long userId; + private final long userId; public UserPrincipal(long userId) { this.userId = userId; diff --git a/src/main/java/org/traccar/api/resource/DeviceResource.java b/src/main/java/org/traccar/api/resource/DeviceResource.java index f9c9a139d..7006cdb84 100644 --- a/src/main/java/org/traccar/api/resource/DeviceResource.java +++ b/src/main/java/org/traccar/api/resource/DeviceResource.java @@ -52,7 +52,7 @@ public class DeviceResource extends BaseObjectResource { @QueryParam("uniqueId") List uniqueIds, @QueryParam("id") List deviceIds) throws SQLException { DeviceManager deviceManager = Context.getDeviceManager(); - Set result = null; + Set result; if (all) { if (Context.getPermissionsManager().getUserAdmin(getUserId())) { result = deviceManager.getAllItems(); diff --git a/src/main/java/org/traccar/api/resource/UserResource.java b/src/main/java/org/traccar/api/resource/UserResource.java index 0b42d8d92..813ace6d6 100644 --- a/src/main/java/org/traccar/api/resource/UserResource.java +++ b/src/main/java/org/traccar/api/resource/UserResource.java @@ -48,7 +48,7 @@ public class UserResource extends BaseObjectResource { @GET public Collection get(@QueryParam("userId") long userId) throws SQLException { UsersManager usersManager = Context.getUsersManager(); - Set result = null; + Set result; if (Context.getPermissionsManager().getUserAdmin(getUserId())) { if (userId != 0) { result = usersManager.getUserItems(userId); diff --git a/src/main/java/org/traccar/database/BaseObjectManager.java b/src/main/java/org/traccar/database/BaseObjectManager.java index d0024c005..be6310033 100644 --- a/src/main/java/org/traccar/database/BaseObjectManager.java +++ b/src/main/java/org/traccar/database/BaseObjectManager.java @@ -38,8 +38,8 @@ public class BaseObjectManager { private final DataManager dataManager; + private final Class baseClass; private Map items; - private Class baseClass; protected BaseObjectManager(DataManager dataManager, Class baseClass) { this.dataManager = dataManager; diff --git a/src/main/java/org/traccar/database/CommandsManager.java b/src/main/java/org/traccar/database/CommandsManager.java index 485402807..843c89e82 100644 --- a/src/main/java/org/traccar/database/CommandsManager.java +++ b/src/main/java/org/traccar/database/CommandsManager.java @@ -41,7 +41,7 @@ public class CommandsManager extends ExtendedObjectManager { private final Map> deviceQueues = new ConcurrentHashMap<>(); - private boolean queueing; + private final boolean queueing; public CommandsManager(DataManager dataManager, boolean queueing) { super(dataManager, Command.class); diff --git a/src/main/java/org/traccar/database/DataManager.java b/src/main/java/org/traccar/database/DataManager.java index 8e9071736..8b9690f77 100644 --- a/src/main/java/org/traccar/database/DataManager.java +++ b/src/main/java/org/traccar/database/DataManager.java @@ -79,7 +79,7 @@ public class DataManager { private boolean generateQueries; - private boolean forceLdap; + private final boolean forceLdap; public DataManager(Config config) throws Exception { this.config = config; diff --git a/src/main/java/org/traccar/database/DeviceManager.java b/src/main/java/org/traccar/database/DeviceManager.java index fe17f7ced..e621e6058 100644 --- a/src/main/java/org/traccar/database/DeviceManager.java +++ b/src/main/java/org/traccar/database/DeviceManager.java @@ -45,11 +45,11 @@ public class DeviceManager extends BaseObjectManager implements Identity private final Config config; private final long dataRefreshDelay; - private boolean lookupGroupsAttribute; + private final boolean lookupGroupsAttribute; private Map devicesByUniqueId; private Map devicesByPhone; - private AtomicLong devicesLastUpdate = new AtomicLong(); + private final AtomicLong devicesLastUpdate = new AtomicLong(); private final Map positions = new ConcurrentHashMap<>(); diff --git a/src/main/java/org/traccar/database/PermissionsManager.java b/src/main/java/org/traccar/database/PermissionsManager.java index ced0df1c0..d2dc62394 100644 --- a/src/main/java/org/traccar/database/PermissionsManager.java +++ b/src/main/java/org/traccar/database/PermissionsManager.java @@ -196,7 +196,7 @@ public class PermissionsManager { public void checkDeviceLimit(long userId) throws SecurityException { int deviceLimit = getUser(userId).getDeviceLimit(); if (deviceLimit != -1) { - int deviceCount = 0; + int deviceCount; if (getUserManager(userId)) { deviceCount = Context.getDeviceManager().getAllManagedItems(userId).size(); } else { diff --git a/src/main/java/org/traccar/database/QueryBuilder.java b/src/main/java/org/traccar/database/QueryBuilder.java index 5528b2320..f57f27e88 100644 --- a/src/main/java/org/traccar/database/QueryBuilder.java +++ b/src/main/java/org/traccar/database/QueryBuilder.java @@ -318,96 +318,72 @@ public final class QueryBuilder { final Class parameterType, final Method method, final String name) { if (parameterType.equals(boolean.class)) { - processors.add(new ResultSetProcessor() { - @Override - public void process(T object, ResultSet resultSet) throws SQLException { - try { - method.invoke(object, resultSet.getBoolean(name)); - } catch (IllegalAccessException | InvocationTargetException error) { - LOGGER.warn("Set property error", error); - } + processors.add((object, resultSet) -> { + try { + method.invoke(object, resultSet.getBoolean(name)); + } catch (IllegalAccessException | InvocationTargetException error) { + LOGGER.warn("Set property error", error); } }); } else if (parameterType.equals(int.class)) { - processors.add(new ResultSetProcessor() { - @Override - public void process(T object, ResultSet resultSet) throws SQLException { - try { - method.invoke(object, resultSet.getInt(name)); - } catch (IllegalAccessException | InvocationTargetException error) { - LOGGER.warn("Set property error", error); - } + processors.add((object, resultSet) -> { + try { + method.invoke(object, resultSet.getInt(name)); + } catch (IllegalAccessException | InvocationTargetException error) { + LOGGER.warn("Set property error", error); } }); } else if (parameterType.equals(long.class)) { - processors.add(new ResultSetProcessor() { - @Override - public void process(T object, ResultSet resultSet) throws SQLException { - try { - method.invoke(object, resultSet.getLong(name)); - } catch (IllegalAccessException | InvocationTargetException error) { - LOGGER.warn("Set property error", error); - } + processors.add((object, resultSet) -> { + try { + method.invoke(object, resultSet.getLong(name)); + } catch (IllegalAccessException | InvocationTargetException error) { + LOGGER.warn("Set property error", error); } }); } else if (parameterType.equals(double.class)) { - processors.add(new ResultSetProcessor() { - @Override - public void process(T object, ResultSet resultSet) throws SQLException { - try { - method.invoke(object, resultSet.getDouble(name)); - } catch (IllegalAccessException | InvocationTargetException error) { - LOGGER.warn("Set property error", error); - } + processors.add((object, resultSet) -> { + try { + method.invoke(object, resultSet.getDouble(name)); + } catch (IllegalAccessException | InvocationTargetException error) { + LOGGER.warn("Set property error", error); } }); } else if (parameterType.equals(String.class)) { - processors.add(new ResultSetProcessor() { - @Override - public void process(T object, ResultSet resultSet) throws SQLException { - try { - method.invoke(object, resultSet.getString(name)); - } catch (IllegalAccessException | InvocationTargetException error) { - LOGGER.warn("Set property error", error); - } + processors.add((object, resultSet) -> { + try { + method.invoke(object, resultSet.getString(name)); + } catch (IllegalAccessException | InvocationTargetException error) { + LOGGER.warn("Set property error", error); } }); } else if (parameterType.equals(Date.class)) { - processors.add(new ResultSetProcessor() { - @Override - public void process(T object, ResultSet resultSet) throws SQLException { - try { - Timestamp timestamp = resultSet.getTimestamp(name); - if (timestamp != null) { - method.invoke(object, new Date(timestamp.getTime())); - } - } catch (IllegalAccessException | InvocationTargetException error) { - LOGGER.warn("Set property error", error); + processors.add((object, resultSet) -> { + try { + Timestamp timestamp = resultSet.getTimestamp(name); + if (timestamp != null) { + method.invoke(object, new Date(timestamp.getTime())); } + } catch (IllegalAccessException | InvocationTargetException error) { + LOGGER.warn("Set property error", error); } }); } else if (parameterType.equals(byte[].class)) { - processors.add(new ResultSetProcessor() { - @Override - public void process(T object, ResultSet resultSet) throws SQLException { - try { - method.invoke(object, resultSet.getBytes(name)); - } catch (IllegalAccessException | InvocationTargetException error) { - LOGGER.warn("Set property error", error); - } + processors.add((object, resultSet) -> { + try { + method.invoke(object, resultSet.getBytes(name)); + } catch (IllegalAccessException | InvocationTargetException error) { + LOGGER.warn("Set property error", error); } }); } else { - processors.add(new ResultSetProcessor() { - @Override - public void process(T object, ResultSet resultSet) throws SQLException { - String value = resultSet.getString(name); - if (value != null && !value.isEmpty()) { - try { - method.invoke(object, Context.getObjectMapper().readValue(value, parameterType)); - } catch (InvocationTargetException | IllegalAccessException | IOException error) { - LOGGER.warn("Set property error", error); - } + processors.add((object, resultSet) -> { + String value = resultSet.getString(name); + if (value != null && !value.isEmpty()) { + try { + method.invoke(object, Context.getObjectMapper().readValue(value, parameterType)); + } catch (InvocationTargetException | IllegalAccessException | IOException error) { + LOGGER.warn("Set property error", error); } } }); @@ -453,12 +429,12 @@ public final class QueryBuilder { while (resultSet.next()) { try { - T object = clazz.newInstance(); + T object = clazz.getDeclaredConstructor().newInstance(); for (ResultSetProcessor processor : processors) { processor.process(object, resultSet); } result.add(object); - } catch (InstantiationException | IllegalAccessException e) { + } catch (ReflectiveOperationException e) { throw new IllegalArgumentException(); } } diff --git a/src/main/java/org/traccar/geofence/GeofenceCircle.java b/src/main/java/org/traccar/geofence/GeofenceCircle.java index f6fca63ca..eda63832d 100644 --- a/src/main/java/org/traccar/geofence/GeofenceCircle.java +++ b/src/main/java/org/traccar/geofence/GeofenceCircle.java @@ -50,7 +50,7 @@ public class GeofenceCircle extends GeofenceGeometry { @Override public String toWkt() { - String wkt = ""; + String wkt; wkt = "CIRCLE ("; wkt += String.valueOf(centerLatitude); wkt += " "; diff --git a/src/main/java/org/traccar/helper/BitBuffer.java b/src/main/java/org/traccar/helper/BitBuffer.java index f30a4557b..323807ba9 100644 --- a/src/main/java/org/traccar/helper/BitBuffer.java +++ b/src/main/java/org/traccar/helper/BitBuffer.java @@ -93,7 +93,7 @@ public class BitBuffer { return result; } else { result &= signBit - 1; - result += ~(signBit - 1); + result += -signBit; return result; } } diff --git a/src/main/java/org/traccar/helper/Checksum.java b/src/main/java/org/traccar/helper/Checksum.java index c1de983d8..8c3d0063a 100644 --- a/src/main/java/org/traccar/helper/Checksum.java +++ b/src/main/java/org/traccar/helper/Checksum.java @@ -26,12 +26,12 @@ public final class Checksum { public static class Algorithm { - private int poly; - private int init; - private boolean refIn; - private boolean refOut; - private int xorOut; - private int[] table; + private final int poly; + private final int init; + private final boolean refIn; + private final boolean refOut; + private final int xorOut; + private final int[] table; public Algorithm(int bits, int poly, int init, boolean refIn, boolean refOut, int xorOut) { this.poly = poly; diff --git a/src/main/java/org/traccar/helper/DateBuilder.java b/src/main/java/org/traccar/helper/DateBuilder.java index 9752f6977..24b7d027a 100644 --- a/src/main/java/org/traccar/helper/DateBuilder.java +++ b/src/main/java/org/traccar/helper/DateBuilder.java @@ -21,7 +21,7 @@ import java.util.TimeZone; public class DateBuilder { - private Calendar calendar; + private final Calendar calendar; public DateBuilder() { this(TimeZone.getTimeZone("UTC")); diff --git a/src/main/java/org/traccar/helper/Parser.java b/src/main/java/org/traccar/helper/Parser.java index 1471ec237..75106e2ba 100644 --- a/src/main/java/org/traccar/helper/Parser.java +++ b/src/main/java/org/traccar/helper/Parser.java @@ -242,7 +242,7 @@ public class Parser { public Date nextDateTime(DateTimeFormat format, String timeZone) { int year = 0, month = 0, day = 0; - int hour = 0, minute = 0, second = 0, millisecond = 0; + int hour, minute, second, millisecond = 0; switch (format) { case HMS: diff --git a/src/main/java/org/traccar/protocol/OwnTracksProtocolDecoder.java b/src/main/java/org/traccar/protocol/OwnTracksProtocolDecoder.java index 323d97fa3..509d14ae4 100644 --- a/src/main/java/org/traccar/protocol/OwnTracksProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/OwnTracksProtocolDecoder.java @@ -110,7 +110,7 @@ public class OwnTracksProtocolDecoder extends BaseHttpProtocolDecoder { if (root.containsKey("t")) { String trigger = root.getString("t"); position.set("t", trigger); - Integer reportType = -1; + int reportType = -1; if (root.containsKey("rty")) { reportType = root.getInt("rty"); } @@ -148,8 +148,8 @@ public class OwnTracksProtocolDecoder extends BaseHttpProtocolDecoder { } if (root.containsKey("anum")) { - Integer numberOfAnalogueInputs = root.getInt("anum"); - for (Integer i = 0; i < numberOfAnalogueInputs; i++) { + int numberOfAnalogueInputs = root.getInt("anum"); + for (int i = 0; i < numberOfAnalogueInputs; i++) { String indexString = String.format("%02d", i); if (root.containsKey("adda-" + indexString)) { position.set(Position.PREFIX_ADC + (i + 1), root.getString("adda-" + indexString)); diff --git a/src/main/java/org/traccar/reports/ReportUtils.java b/src/main/java/org/traccar/reports/ReportUtils.java index 3a631e0d9..c60c6ba1e 100644 --- a/src/main/java/org/traccar/reports/ReportUtils.java +++ b/src/main/java/org/traccar/reports/ReportUtils.java @@ -81,8 +81,7 @@ public final class ReportUtils { } public static Collection getDeviceList(Collection deviceIds, Collection groupIds) { - Collection result = new ArrayList<>(); - result.addAll(deviceIds); + Collection result = new ArrayList<>(deviceIds); for (long groupId : groupIds) { result.addAll(Context.getPermissionsManager().getGroupDevices(groupId)); } -- cgit v1.2.3