aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/api/resource/DeviceResource.java2
-rw-r--r--src/org/traccar/api/resource/SessionResource.java11
-rw-r--r--src/org/traccar/notification/EventForwarder.java4
-rw-r--r--src/org/traccar/web/CsvBuilder.java2
4 files changed, 9 insertions, 10 deletions
diff --git a/src/org/traccar/api/resource/DeviceResource.java b/src/org/traccar/api/resource/DeviceResource.java
index ddf8832ed..87927e45b 100644
--- a/src/org/traccar/api/resource/DeviceResource.java
+++ b/src/org/traccar/api/resource/DeviceResource.java
@@ -71,7 +71,7 @@ public class DeviceResource extends BaseObjectResource<Device> {
result = deviceManager.getUserItems(userId);
}
} else {
- result = new HashSet<Long>();
+ result = new HashSet<>();
for (String uniqueId : uniqueIds) {
Device device = deviceManager.getByUniqueId(uniqueId);
Context.getPermissionsManager().checkDevice(getUserId(), device.getId());
diff --git a/src/org/traccar/api/resource/SessionResource.java b/src/org/traccar/api/resource/SessionResource.java
index 3f7842626..2a0bd4364 100644
--- a/src/org/traccar/api/resource/SessionResource.java
+++ b/src/org/traccar/api/resource/SessionResource.java
@@ -61,15 +61,14 @@ public class SessionResource extends BaseResource {
Cookie[] cookies = request.getCookies();
String email = null, password = null;
if (cookies != null) {
- for (int i = 0; i < cookies.length; i++) {
- if (cookies[i].getName().equals(USER_COOKIE_KEY)) {
+ for (Cookie cookie : cookies) {
+ if (cookie.getName().equals(USER_COOKIE_KEY)) {
byte[] emailBytes = DatatypeConverter.parseBase64Binary(
- URLDecoder.decode(cookies[i].getValue(), StandardCharsets.US_ASCII.name()));
+ URLDecoder.decode(cookie.getValue(), StandardCharsets.US_ASCII.name()));
email = new String(emailBytes, StandardCharsets.UTF_8);
- }
- if (cookies[i].getName().equals(PASS_COOKIE_KEY)) {
+ } else if (cookie.getName().equals(PASS_COOKIE_KEY)) {
byte[] passwordBytes = DatatypeConverter.parseBase64Binary(
- URLDecoder.decode(cookies[i].getValue(), StandardCharsets.US_ASCII.name()));
+ URLDecoder.decode(cookie.getValue(), StandardCharsets.US_ASCII.name()));
password = new String(passwordBytes, StandardCharsets.UTF_8);
}
}
diff --git a/src/org/traccar/notification/EventForwarder.java b/src/org/traccar/notification/EventForwarder.java
index ad8134f18..d1bdd4aba 100644
--- a/src/org/traccar/notification/EventForwarder.java
+++ b/src/org/traccar/notification/EventForwarder.java
@@ -17,7 +17,7 @@ package org.traccar.notification;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.ning.http.client.AsyncHttpClient.BoundRequestBuilder;
-import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import org.traccar.Context;
@@ -73,7 +73,7 @@ public abstract class EventForwarder {
for (String paramLine: paramsLines) {
splitedLine = paramLine.split(separator, 2);
if (splitedLine.length == 2) {
- paramsMap.put(splitedLine[0].trim(), Arrays.asList(splitedLine[1].trim()));
+ paramsMap.put(splitedLine[0].trim(), Collections.singletonList(splitedLine[1].trim()));
}
}
return paramsMap;
diff --git a/src/org/traccar/web/CsvBuilder.java b/src/org/traccar/web/CsvBuilder.java
index 2bbe89788..fa99f1b18 100644
--- a/src/org/traccar/web/CsvBuilder.java
+++ b/src/org/traccar/web/CsvBuilder.java
@@ -51,7 +51,7 @@ public class CsvBuilder {
private SortedSet<Method> getSortedMethods(Object object) {
Method[] methodArray = object.getClass().getMethods();
- SortedSet<Method> methods = new TreeSet<Method>(new Comparator<Method>() {
+ SortedSet<Method> methods = new TreeSet<>(new Comparator<Method>() {
@Override
public int compare(Method m1, Method m2) {
if (m1.getName().equals("getAttributes") && !m1.getName().equals(m2.getName())) {