From 132b3b21bb7f56fa880a7024d581f36b98b78a7f Mon Sep 17 00:00:00 2001 From: Evgeny S Maksimov Date: Mon, 17 Dec 2018 12:12:56 +0300 Subject: Added check of the group parameter. --- src/org/traccar/WebDataHandler.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/org') diff --git a/src/org/traccar/WebDataHandler.java b/src/org/traccar/WebDataHandler.java index 49033fc3a..c7ce7485d 100644 --- a/src/org/traccar/WebDataHandler.java +++ b/src/org/traccar/WebDataHandler.java @@ -140,16 +140,19 @@ public class WebDataHandler extends BaseDataHandler { request = request.replace("{gprmc}", formatSentence(position)); } - String deviceGroupName = ""; - - if (device.getGroupId() != 0) { - Group group = Context.getGroupsManager().getById(device.getGroupId()); - if (group != null) { + if (request.contains("{group}")) { + String deviceGroupName = ""; + if (device.getGroupId() != 0) { + Group group = Context.getGroupsManager().getById(device.getGroupId()); + if (group != null) { deviceGroupName = group.getName(); + } } + + request = request.replace("{group}", URLEncoder.encode(deviceGroupName, StandardCharsets.UTF_8.name())); } - return request.replace("{group}", URLEncoder.encode(deviceGroupName, StandardCharsets.UTF_8.name())); + return request; } @Override -- cgit v1.2.3