Skip to content

Commit bc228ce

Browse files
committed
fix:fix NullPointerException when properties contain kv with null value.
1 parent 3ddfd85 commit bc228ce

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
@@ -21,3 +21,4 @@
2121
- [feat: support nacos namespace mapping](https://github.com/Tencent/spring-cloud-tencent/pull/1191)
2222
- [fix:fix sct-all wrong spring boot version obtain.](https://github.com/Tencent/spring-cloud-tencent/pull/1204)
2323
- fix:fix restTemplateCustomizer bean conflict causing service to fail to start properly.
24+
- fix:fix NullPointerException when properties contain kv with null value.

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090

9191
<properties>
9292
<!-- Project revision -->
93-
<revision>1.13.1-Hoxton.SR12</revision>
93+
<revision>1.13.2-Hoxton.SR12</revision>
9494

9595
<!-- Spring Framework -->
9696
<spring.framework.version>5.2.25.RELEASE</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
@@ -118,6 +118,11 @@ public static ExecutorService executor() {
118118
* @param ret origin properties map
119119
*/
120120
static void initialize(Map<String, Object> ret) {
121+
for (Map.Entry<String, Object> entry : ret.entrySet()) {
122+
if (entry.getValue() == null) {
123+
ret.put(entry.getKey(), "");
124+
}
125+
}
121126
properties.putAll(ret);
122127
}
123128

@@ -144,6 +149,9 @@ static Map<String, ConfigPropertyChangeInfo> merge(Map<String, Object> ret) {
144149
ret.keySet().parallelStream().forEach(key -> {
145150
Object oldValue = properties.getIfPresent(key);
146151
Object newValue = ret.get(key);
152+
if (newValue == null) {
153+
newValue = "";
154+
}
147155
if (oldValue != null) {
148156
if (!newValue.equals(oldValue)) {
149157
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-Hoxton.SR12</revision>
73+
<revision>1.13.2-Hoxton.SR12</revision>
7474

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

0 commit comments

Comments
 (0)