Browse Source

Merge pull request #15455 from thingsboard/rc

Merge rc into master
pull/14901/head
Viacheslav Klimov 1 month ago
committed by GitHub
parent
commit
00f746c1cc
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 11
      common/cache/src/main/java/org/thingsboard/server/cache/TbJsonRedisSerializer.java
  2. 2
      rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/rest/TbRestApiCallNodeTest.java

11
common/cache/src/main/java/org/thingsboard/server/cache/TbJsonRedisSerializer.java

@ -18,6 +18,8 @@ package org.thingsboard.server.cache;
import org.springframework.data.redis.serializer.SerializationException;
import org.thingsboard.common.util.JacksonUtil;
import java.io.IOException;
public class TbJsonRedisSerializer<K, V> implements TbRedisSerializer<K, V> {
private final Class<V> clazz;
@ -33,6 +35,13 @@ public class TbJsonRedisSerializer<K, V> implements TbRedisSerializer<K, V> {
@Override
public V deserialize(K key, byte[] bytes) throws SerializationException {
return JacksonUtil.fromBytes(bytes, clazz);
if (bytes == null) {
return null;
}
try {
return JacksonUtil.IGNORE_UNKNOWN_PROPERTIES_JSON_MAPPER.readValue(bytes, clazz);
} catch (IOException e) {
throw new SerializationException("Failed to deserialize cached value", e);
}
}
}

2
rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/rest/TbRestApiCallNodeTest.java

@ -28,6 +28,7 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.parallel.ResourceLock;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.ValueSource;
@ -82,6 +83,7 @@ import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.verify;
@ExtendWith(MockitoExtension.class)
@ResourceLock("SsrfProtectionValidator") // to avoid race conditions when modifying SsrfProtectionValidator's static configuration
public class TbRestApiCallNodeTest extends AbstractRuleNodeUpgradeTest {
static final long TIMEOUT = TimeUnit.SECONDS.toMillis(30);

Loading…
Cancel
Save