Skip to content

Commit 1edd1d5

Browse files
committed
Protect against NPE when groups property is missing
Closes gh-37888
1 parent efd9aa9 commit 1edd1d5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

buildSrc/src/main/java/org/springframework/boot/build/context/properties/CheckAdditionalSpringConfigurationMetadata.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ private Report createReport() throws IOException, JsonParseException, JsonMappin
9393

9494
@SuppressWarnings("unchecked")
9595
private void check(String key, Map<String, Object> json, Analysis analysis) {
96-
List<Map<String, Object>> groups = (List<Map<String, Object>>) json.get(key);
96+
List<Map<String, Object>> groups = (List<Map<String, Object>>) json.getOrDefault(key, Collections.emptyList());
9797
List<String> names = groups.stream().map((group) -> (String) group.get("name")).toList();
9898
List<String> sortedNames = sortedCopy(names);
9999
for (int i = 0; i < names.size(); i++) {

0 commit comments

Comments
 (0)