Skip to content

Commit 58beaf7

Browse files
committed
fix:fix NullPointerException when properties contain kv with null value.
1 parent ca37ff3 commit 58beaf7

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

CHANGELOG.md

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

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989

9090
<properties>
9191
<!-- Project revision -->
92-
<revision>1.13.1-2021.0.9</revision>
92+
<revision>1.13.2-2021.0.9</revision>
9393

9494
<!-- Spring Framework -->
9595
<spring.framework.version>5.3.31</spring.framework.version>

spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/listener/PolarisConfigListenerContext.java

+8
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ public static ExecutorService executor() {
116116
* @param ret origin properties map
117117
*/
118118
static void initialize(Map<String, Object> ret) {
119+
for (Map.Entry<String, Object> entry : ret.entrySet()) {
120+
if (entry.getValue() == null) {
121+
ret.put(entry.getKey(), "");
122+
}
123+
}
119124
properties.putAll(ret);
120125
}
121126

@@ -142,6 +147,9 @@ static Map<String, ConfigPropertyChangeInfo> merge(Map<String, Object> ret) {
142147
ret.keySet().parallelStream().forEach(key -> {
143148
Object oldValue = properties.getIfPresent(key);
144149
Object newValue = ret.get(key);
150+
if (newValue == null) {
151+
newValue = "";
152+
}
145153
if (oldValue != null) {
146154
if (!newValue.equals(oldValue)) {
147155
properties.put(key, newValue);

spring-cloud-tencent-dependencies/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
</developers>
7171

7272
<properties>
73-
<revision>1.13.1-2021.0.9</revision>
73+
<revision>1.13.2-2021.0.9</revision>
7474

7575
<!-- Dependencies -->
7676
<polaris.version>1.15.0</polaris.version>

0 commit comments

Comments
 (0)