Skip to content

Commit 7a57993

Browse files
committed
fix:fix NullPointerException when properties contain kv with null value.
1 parent 4d7e342 commit 7a57993

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
@@ -23,3 +23,4 @@
2323
- [fix:fix sct-all wrong spring boot version obtain.](https://github.com/Tencent/spring-cloud-tencent/pull/1205)
2424
- [fix:fix swagger not working bug.](https://github.com/Tencent/spring-cloud-tencent/pull/1225)
2525
- fix:fix restTemplateCustomizer bean conflict causing service to fail to start properly.
26+
- 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-2020.0.6</revision>
92+
<revision>1.13.2-2020.0.6</revision>
9393

9494
<!-- Spring Framework -->
9595
<spring.framework.version>5.3.25</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-2020.0.6</revision>
73+
<revision>1.13.2-2020.0.6</revision>
7474

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

0 commit comments

Comments
 (0)