Skip to content

Throw IllegalArgumentException when getManifest is called without Session and classpath is enabled#378

Open
elharo wants to merge 1 commit into
apache:masterfrom
elharo:fix-364-npe-getmanifest
Open

Throw IllegalArgumentException when getManifest is called without Session and classpath is enabled#378
elharo wants to merge 1 commit into
apache:masterfrom
elharo:fix-364-npe-getmanifest

Conversation

@elharo

@elharo elharo commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Fixes #364

getManifest(Project, ManifestConfiguration) passes null for Session. When addClasspath or addExtensions is enabled, doGetManifest() dereferences the null session, causing a NullPointerException.

This adds a null check that throws an informative IllegalArgumentException telling callers to use the three-parameter overload with a non-null Session.

Test-first

  • Wrote a test that reproduces the NPE (red)
  • Added the null check in doGetManifest() (green)
  • All existing tests still pass

…sion and classpath is enabled

The two-parameter getManifest(Project, ManifestConfiguration) passes null
for Session. When addClasspath or addExtensions is enabled, doGetManifest
dereferences the null session, causing a NullPointerException.

Add a null check that throws an informative IllegalArgumentException
telling callers to use the three-parameter overload with a non-null Session.

Fixes apache#364
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NPE in getManifest(Project, ManifestConfiguration) when addClasspath is enabled

1 participant