Skip to content

[wagon-3.x] Fix NPE in ScpExternalWagon when localFile has no parent directory - #966

Merged
slachiewicz merged 1 commit into
apache:wagon-3.xfrom
slachiewicz:scpexe-relative-parent-3.x
Sep 3, 2026
Merged

[wagon-3.x] Fix NPE in ScpExternalWagon when localFile has no parent directory#966
slachiewicz merged 1 commit into
apache:wagon-3.xfrom
slachiewicz:scpexe-relative-parent-3.x

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

Supersedes #817 with added unit test coverage and updated codebase conventions.

When localFile is specified as a bare relative filename (such as via mvn gpg:sign-and-deploy-file -Dfiles=artifact-sources.jar), localFile.getParentFile() returns null, causing a NullPointerException when calling localFile.getParentFile().getAbsolutePath().

  • Safely resolve the working directory to localFile.getAbsoluteFile().getParentFile() when localFile.getParentFile() is null.
  • Add ExternalScpWagonTest with offline unit tests verifying commandline construction with both bare relative files and parented files, as well as PuTTY detection.

Co-authored-by: Sven Göthel sgothel@jausoft.com

When localFile is specified as a bare relative filename (e.g. via
mvn gpg:sign-and-deploy-file -Dfiles=artifact-sources.jar),
localFile.getParentFile() returns null, causing a NullPointerException
when calling getAbsolutePath().

Safely resolve the working directory to localFile.getAbsoluteFile().getParentFile()
when localFile.getParentFile() is null, and add offline unit tests in
ExternalScpWagonTest covering both relative and parented files.

Co-authored-by: Sven Göthel <sgothel@jausoft.com>
@slachiewicz
slachiewicz force-pushed the scpexe-relative-parent-3.x branch from 0be92bf to 43e57fe Compare September 3, 2026 20:19
@slachiewicz slachiewicz added mvn3 bug Something isn't working labels Sep 3, 2026
@slachiewicz
slachiewicz merged commit c61c00d into apache:wagon-3.x Sep 3, 2026
8 checks passed
@slachiewicz
slachiewicz deleted the scpexe-relative-parent-3.x branch September 3, 2026 20:45
@github-actions github-actions Bot added this to the 3.5.4 milestone Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working mvn3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant