Browse Source

Protect against null key insertion in MapConfigurationPropertySource

See gh-46926
pull/46995/head
Moritz Halbritter 4 months ago
parent
commit
5656c13f31
  1. 5
      core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/MapConfigurationPropertySource.java

5
core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/MapConfigurationPropertySource.java

@ -77,8 +77,9 @@ public class MapConfigurationPropertySource implements IterableConfigurationProp @@ -77,8 +77,9 @@ public class MapConfigurationPropertySource implements IterableConfigurationProp
* @param name the name
* @param value the value
*/
public void put(@Nullable Object name, Object value) {
this.source.put((name != null) ? name.toString() : null, value);
public void put(Object name, Object value) {
Assert.notNull(name, "'name' must not be null");
this.source.put(name.toString(), value);
}
@Override

Loading…
Cancel
Save