From e89bbb8ee9dd1dd1f19fb33f1f9291c6ae5f43db Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Wed, 23 Nov 2016 17:34:25 +0500 Subject: Implement attributes helpers --- src/org/traccar/BaseProtocolEncoder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/org/traccar/BaseProtocolEncoder.java') diff --git a/src/org/traccar/BaseProtocolEncoder.java b/src/org/traccar/BaseProtocolEncoder.java index 5c2c503e4..3c2d08471 100644 --- a/src/org/traccar/BaseProtocolEncoder.java +++ b/src/org/traccar/BaseProtocolEncoder.java @@ -31,8 +31,8 @@ public abstract class BaseProtocolEncoder extends OneToOneEncoder { protected void initDevicePassword(Command command, String defaultPassword) { if (!command.getAttributes().containsKey(Command.KEY_DEVICE_PASSWORD)) { Device device = Context.getIdentityManager().getDeviceById(command.getDeviceId()); - if (device.getAttributes().containsKey(Command.KEY_DEVICE_PASSWORD)) { - String password = (String) device.getAttributes().get(Command.KEY_DEVICE_PASSWORD); + String password = device.getString(Command.KEY_DEVICE_PASSWORD); + if (password != null) { command.set(Command.KEY_DEVICE_PASSWORD, password); } else { command.set(Command.KEY_DEVICE_PASSWORD, defaultPassword); -- cgit v1.2.3