Skip to content

Commit 5656c13

Browse files
committed
Protect against null key insertion in MapConfigurationPropertySource
See gh-46926
1 parent 6723cfd commit 5656c13

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ public void putAll(Map<?, ?> map) {
7777
* @param name the name
7878
* @param value the value
7979
*/
80-
public void put(@Nullable Object name, Object value) {
81-
this.source.put((name != null) ? name.toString() : null, value);
80+
public void put(Object name, Object value) {
81+
Assert.notNull(name, "'name' must not be null");
82+
this.source.put(name.toString(), value);
8283
}
8384

8485
@Override

0 commit comments

Comments
 (0)