aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/BaseProtocolEncoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-07-12 10:34:57 -0700
committerGitHub <noreply@github.com>2019-07-12 10:34:57 -0700
commit2ce793cfe7df9ec68708722489cec267ddda0b2b (patch)
tree31971fe8ac67abc607bcb315ada9667d309fda75 /src/main/java/org/traccar/BaseProtocolEncoder.java
parent0130b9093bca894268493d27173e8ecac02c0179 (diff)
parent1da58124acf0ce8c820b78519d17c2a408aced24 (diff)
downloadtrackermap-server-2ce793cfe7df9ec68708722489cec267ddda0b2b.tar.gz
trackermap-server-2ce793cfe7df9ec68708722489cec267ddda0b2b.tar.bz2
trackermap-server-2ce793cfe7df9ec68708722489cec267ddda0b2b.zip
Merge pull request #4342 from edvalley/proposed
Enhance Laipac protocol decoder and encoder
Diffstat (limited to 'src/main/java/org/traccar/BaseProtocolEncoder.java')
-rw-r--r--src/main/java/org/traccar/BaseProtocolEncoder.java13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/main/java/org/traccar/BaseProtocolEncoder.java b/src/main/java/org/traccar/BaseProtocolEncoder.java
index d7625e4b8..6d96280f7 100644
--- a/src/main/java/org/traccar/BaseProtocolEncoder.java
+++ b/src/main/java/org/traccar/BaseProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 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.
@@ -22,7 +22,6 @@ import io.netty.channel.ChannelPromise;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.traccar.model.Command;
-import org.traccar.model.Device;
public abstract class BaseProtocolEncoder extends ChannelOutboundHandlerAdapter {
@@ -34,13 +33,9 @@ public abstract class BaseProtocolEncoder extends ChannelOutboundHandlerAdapter
protected void initDevicePassword(Command command, String defaultPassword) {
if (!command.getAttributes().containsKey(Command.KEY_DEVICE_PASSWORD)) {
- Device device = Context.getIdentityManager().getById(command.getDeviceId());
- 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);
- }
+ String password = Context.getIdentityManager()
+ .getDevicePassword(command.getDeviceId(), defaultPassword);
+ command.set(Command.KEY_DEVICE_PASSWORD, password);
}
}