Skip to content

Commit

Permalink
fix:fix NullPointerException when properties contain kv with null value.
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyeBeFreeman committed Apr 25, 2024
1 parent 4d7e342 commit 7a57993
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@
- [fix:fix sct-all wrong spring boot version obtain.](https://github.com/Tencent/spring-cloud-tencent/pull/1205)
- [fix:fix swagger not working bug.](https://github.com/Tencent/spring-cloud-tencent/pull/1225)
- fix:fix restTemplateCustomizer bean conflict causing service to fail to start properly.
- fix:fix NullPointerException when properties contain kv with null value.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@

<properties>
<!-- Project revision -->
<revision>1.13.1-2020.0.6</revision>
<revision>1.13.2-2020.0.6</revision>

<!-- Spring Framework -->
<spring.framework.version>5.3.25</spring.framework.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ public static ExecutorService executor() {
* @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);
}

Expand All @@ -142,6 +147,9 @@ static Map<String, ConfigPropertyChangeInfo> merge(Map<String, Object> ret) {
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);
Expand Down
2 changes: 1 addition & 1 deletion spring-cloud-tencent-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
</developers>

<properties>
<revision>1.13.1-2020.0.6</revision>
<revision>1.13.2-2020.0.6</revision>

<!-- Dependencies -->
<polaris.version>1.15.0</polaris.version>
Expand Down

0 comments on commit 7a57993

Please sign in to comment.