Skip to content

fix: prevent NPE in ManifestConfiguration.getClasspathPrefix() when prefix is null - #381

Open
elharo wants to merge 1 commit into
apache:masterfrom
elharo:fix-367-npe-classpath-prefix
Open

fix: prevent NPE in ManifestConfiguration.getClasspathPrefix() when prefix is null#381
elharo wants to merge 1 commit into
apache:masterfrom
elharo:fix-367-npe-classpath-prefix

Conversation

@elharo

@elharo elharo commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #367.

Problem: ManifestConfiguration.getClasspathPrefix() calls .replaceAll() on the field without a null check. The field is initialized to "", but the setter stores the value as-is. If any caller passes null (e.g., from unset XML configuration elements mapped via Plexus), the getter throws NPE.

Fix: Guard setClasspathPrefix() against null, falling back to "".

Test: Added getClasspathPrefixShouldHandleNull().

…refix is null

The setter now treats null as the empty string, consistent with the field's
default value. This prevents a NullPointerException in getClasspathPrefix()
when callers pass null (e.g., from unset XML configuration elements).

Fixes apache#367
@elharo
elharo force-pushed the fix-367-npe-classpath-prefix branch from dbe9d8c to ac18752 Compare July 4, 2026 13:06
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 ManifestConfiguration.getClasspathPrefix() when prefix is set to null

1 participant