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

1.13.2-2023.0.0
Haotian Zhang 1 year ago
parent f3aa8ac57d
commit 929b08b0ab

@ -2,3 +2,4 @@
--- ---
[fix: fix RouterLabelRestTemplateInterceptor add response headers exception with httpclient5.](https://github.com/Tencent/spring-cloud-tencent/pull/1239) [fix: fix RouterLabelRestTemplateInterceptor add response headers exception with httpclient5.](https://github.com/Tencent/spring-cloud-tencent/pull/1239)
- fix:fix NullPointerException when properties contain kv with null value.

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

@ -116,6 +116,11 @@ public final class PolarisConfigListenerContext {
* @param ret origin properties map * @param ret origin properties map
*/ */
static void initialize(Map<String, Object> ret) { 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); properties.putAll(ret);
} }
@ -142,6 +147,9 @@ public final class PolarisConfigListenerContext {
ret.keySet().parallelStream().forEach(key -> { ret.keySet().parallelStream().forEach(key -> {
Object oldValue = properties.getIfPresent(key); Object oldValue = properties.getIfPresent(key);
Object newValue = ret.get(key); Object newValue = ret.get(key);
if (newValue == null) {
newValue = "";
}
if (oldValue != null) { if (oldValue != null) {
if (!newValue.equals(oldValue)) { if (!newValue.equals(oldValue)) {
properties.put(key, newValue); properties.put(key, newValue);

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

Loading…
Cancel
Save