Skip to content

[backport 4.0.x] Fix #12590: NPE on null rootDirectory in DefaultModelBuilder - #12903

Merged
gnodet merged 1 commit into
maven-4.0.xfrom
backport/12866
Aug 28, 2026
Merged

[backport 4.0.x] Fix #12590: NPE on null rootDirectory in DefaultModelBuilder#12903
gnodet merged 1 commit into
maven-4.0.xfrom
backport/12866

Conversation

@gnodet

@gnodet gnodet commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Backport of #12866 to maven-4.0.x.

Original PR: #12866

Add null checks for rootDirectory in getEnhancedProperties() to prevent
NullPointerException when both session.getRootDirectory() throws and
modelSource.getPath() returns null.

Two locations are guarded:
- rootDirectory.toString()/toUri() calls (lines 731-738): wrapped in
  null check so properties are simply omitted when root is unavailable
- Objects.equals check before locateExistingPom (line 741): added
  rootDirectory != null guard to prevent passing null to POM locator

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet added this to the 4.0.0-rc-7 milestone Aug 28, 2026
@gnodet
gnodet merged commit 2154c82 into maven-4.0.x Aug 28, 2026
23 checks passed
@gnodet
gnodet deleted the backport/12866 branch August 28, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant