diff options
Diffstat (limited to 'src/org/traccar/processing/CopyAttributesHandler.java')
-rw-r--r-- | src/org/traccar/processing/CopyAttributesHandler.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/org/traccar/processing/CopyAttributesHandler.java b/src/org/traccar/processing/CopyAttributesHandler.java index a9e761c3d..9fbcfa73f 100644 --- a/src/org/traccar/processing/CopyAttributesHandler.java +++ b/src/org/traccar/processing/CopyAttributesHandler.java @@ -32,10 +32,14 @@ public class CopyAttributesHandler extends BaseDataHandler { @Override protected Position handlePosition(Position position) { String attributesString = Context.getDeviceManager().lookupAttributeString( - position.getDeviceId(), "processing.copyAttributes", null, true); + position.getDeviceId(), "processing.copyAttributes", "", true); Position last = getLastPosition(position.getDeviceId()); - if (attributesString != null && last != null) { - attributesString += Position.KEY_DRIVER_UNIQUE_ID + ","; + if (attributesString.isEmpty()) { + attributesString = Position.KEY_DRIVER_UNIQUE_ID; + } else { + attributesString += "," + Position.KEY_DRIVER_UNIQUE_ID; + } + if (last != null) { for (String attribute : attributesString.split("[ ,]")) { if (last.getAttributes().containsKey(attribute) && !position.getAttributes().containsKey(attribute)) { position.getAttributes().put(attribute, last.getAttributes().get(attribute)); |