Skip to content

Commit e3980bd

Browse files
abhu85claude
andcommitted
Fix gh-11740: Add missing null check in validateProfileId()
The validateProfileId() method was missing a null check before calling validProfileIds.contains(id). Since validProfileIds uses ConcurrentHashMap.newKeySet() which doesn't allow null keys, a null profile ID would cause a NullPointerException instead of a proper validation error. This makes validateProfileId() consistent with validateCoordinateId() which already has the null check. Fixes #11740 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 71bd10f commit e3980bd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelValidator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1792,7 +1792,7 @@ private boolean validateProfileId(
17921792
String id,
17931793
@Nullable SourceHint sourceHint,
17941794
InputLocationTracker tracker) {
1795-
if (validProfileIds.contains(id)) {
1795+
if (id != null && validProfileIds.contains(id)) {
17961796
return true;
17971797
}
17981798
if (!validateStringNotEmpty(prefix, fieldName, problems, severity, version, id, sourceHint, tracker)) {

0 commit comments

Comments
 (0)