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

pull/1332/head 1.13.2-2021.0.9
Haotian Zhang 1 year ago
parent ca37ff3889
commit 58beaf7d2a

@ -24,3 +24,4 @@
- [fix:fix reporter wrong initialization when using config data.](https://github.com/Tencent/spring-cloud-tencent/pull/1221)
- [fix:fix swagger not working bug.](https://github.com/Tencent/spring-cloud-tencent/pull/1224)
- fix:fix restTemplateCustomizer bean conflict causing service to fail to start properly.
- fix:fix NullPointerException when properties contain kv with null value.

@ -89,7 +89,7 @@
<properties>
<!-- Project revision -->
<revision>1.13.1-2021.0.9</revision>
<revision>1.13.2-2021.0.9</revision>
<!-- Spring Framework -->
<spring.framework.version>5.3.31</spring.framework.version>

@ -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);

@ -70,7 +70,7 @@
</developers>
<properties>
<revision>1.13.1-2021.0.9</revision>
<revision>1.13.2-2021.0.9</revision>
<!-- Dependencies -->
<polaris.version>1.15.0</polaris.version>

Loading…
Cancel
Save