fix:fix NullPointerException when properties contain kv with null value.

pull/1293/head
Haotian Zhang 2 months ago
parent 0fc1d2dacd
commit 8159888db2

@ -22,3 +22,4 @@
- [fix:fix sct-all wrong spring boot version obtain.](https://github.com/Tencent/spring-cloud-tencent/pull/1206)
- [fix:fix reporter wrong initialization when using config data.](https://github.com/Tencent/spring-cloud-tencent/pull/1220)
- [fix:fix restTemplateCustomizer bean conflict causing service to fail to start properly](https://github.com/Tencent/spring-cloud-tencent/pull/1238)
- fix:fix NullPointerException when properties contain kv with null value.

@ -116,6 +116,11 @@ public final class PolarisConfigListenerContext {
* @param ret origin properties map
*/
static void initialize(Map<String, Object> ret) {
for (Map.Entry<String, Object> entry : ret.entrySet()) {
if (entry.getValue() == null) {
ret.put(entry.getKey(), "");
}
}
properties.putAll(ret);
}
@ -142,6 +147,9 @@ public final class PolarisConfigListenerContext {
ret.keySet().parallelStream().forEach(key -> {
Object oldValue = properties.getIfPresent(key);
Object newValue = ret.get(key);
if (newValue == null) {
newValue = "";
}
if (oldValue != null) {
if (!newValue.equals(oldValue)) {
properties.put(key, newValue);

Loading…
Cancel
Save