LWM2M: Catch client serialization error.

This commit is contained in:
Igor Kulikov 2024-04-18 13:34:47 +03:00
parent 275aac5ddc
commit f0cd43db5c

View File

@ -94,9 +94,13 @@ public class TbRedisLwM2MClientStore implements TbLwM2MClientStore {
if (client.getState().equals(LwM2MClientState.UNREGISTERED)) { if (client.getState().equals(LwM2MClientState.UNREGISTERED)) {
log.error("[{}] Client is in invalid state: {}!", client.getEndpoint(), client.getState(), new Exception()); log.error("[{}] Client is in invalid state: {}!", client.getEndpoint(), client.getState(), new Exception());
} else { } else {
byte[] clientSerialized = serialize(client); try {
try (var connection = connectionFactory.getConnection()) { byte[] clientSerialized = serialize(client);
connection.getSet(getKey(client.getEndpoint()), clientSerialized); try (var connection = connectionFactory.getConnection()) {
connection.getSet(getKey(client.getEndpoint()), clientSerialized);
}
} catch (Exception e) {
log.warn("Failed to serialize client: {}", client, e);
} }
} }
} }