Skip to content

Fix NPE in ScpExternalWagon when localFile has no parent directory - #967

Merged
slachiewicz merged 1 commit into
apache:masterfrom
slachiewicz:scpexe-relative-parent-master
Sep 3, 2026
Merged

Fix NPE in ScpExternalWagon when localFile has no parent directory#967
slachiewicz merged 1 commit into
apache:masterfrom
slachiewicz:scpexe-relative-parent-master

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

Forward-port of #966 to master (supersedes #817).

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-master branch from 9b995ec to 6f312b8 Compare September 3, 2026 20:19
@slachiewicz slachiewicz added the bug Something isn't working label Sep 3, 2026
@slachiewicz
slachiewicz merged commit 05d457e into apache:master Sep 3, 2026
10 of 16 checks passed
@github-actions github-actions Bot added this to the 4.0.0-M1 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant