Visitar URL original
Fix potential null pointer in AetherResolver.resolveDependencies by askoog · Pull Request #980 · ascopes/protobuf-maven-plugin · GitHub
Skip to content

Fix potential null pointer in AetherResolver.resolveDependencies - #980

Merged
ascopes merged 2 commits into
ascopes:mainfrom
askoog:fix-nullpointer-in-resolve-dependencies
Apr 8, 2026
Merged

ascopes merged 2 commits into
ascopes:mainfrom
askoog:fix-nullpointer-in-resolve-dependencies

Conversation

@askoog

@askoog askoog commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

If dependency resolution fails with e.g. a 401 response, the ArtifactResult::getArtifact might return null, resulting in a NullPointerException

[ERROR] Generation aborted due to an unexpected error - java.lang.NullPointerException
java.lang.NullPointerException
    at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:197)
    at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:197)
    at java.util.stream.ReferencePipeline$2$1.accept (ReferencePipeline.java:179)
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining (ArrayList.java:1625)
    at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:509)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:499)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential (ReduceOps.java:921)
    at java.util.stream.AbstractPipeline.evaluate (AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect (ReferencePipeline.java:682)
    at io.github.ascopes.protobufmavenplugin.dependencies.aether.AetherResolver.resolveDependencies (AetherResolver.java:159)
    at io.github.ascopes.protobufmavenplugin.dependencies.aether.AetherMavenArtifactPathResolver.resolveDependencies (AetherMavenArtifactPathResolver.java:135)
    at io.github.ascopes.protobufmavenplugin.sources.ProjectInputResolver.resolveCompilableProtoSources (ProjectInputResolver.java:87)
    at io.github.ascopes.protobufmavenplugin.sources.ProjectInputResolver.resolveProjectInputs (ProjectInputResolver.java:66)
    at io.github.ascopes.protobufmavenplugin.generation.ProtobufBuildOrchestrator.generate (ProtobufBuildOrchestrator.java:112)
    at io.github.ascopes.protobufmavenplugin.mojo.AbstractGenerateMojo.execute (AbstractGenerateMojo.java:928)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)

This PR fallback to use the requersted artifact instead, to provide a more user friendly error message

@ascopes

ascopes commented Apr 8, 2026

Copy link
Copy Markdown
Owner

Good spot, thanks for fixing.

@ascopes ascopes self-assigned this Apr 8, 2026
@ascopes ascopes added the bug Something isn't working label Apr 8, 2026
@codecov

codecov Bot commented Apr 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.87%. Comparing base (aeecace) to head (daf6764).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #980      +/-   ##
==========================================
+ Coverage   93.86%   93.87%   +0.01%     
==========================================
  Files          76       76              
  Lines        2035     2036       +1     
  Branches      134      134              
==========================================
+ Hits         1910     1911       +1     
  Misses         90       90              
  Partials       35       35              
Flag Coverage Δ
maven-3.9.14-java-17-macos-15 92.34% <100.00%> (+0.01%) ⬆️
maven-3.9.14-java-17-ubuntu-24.04 93.13% <100.00%> (+0.01%) ⬆️
maven-3.9.14-java-17-ubuntu-24.04-arm 92.34% <100.00%> (+0.01%) ⬆️
maven-3.9.14-java-17-windows-2025 91.56% <100.00%> (+0.01%) ⬆️
maven-3.9.14-java-21-ubuntu-24.04 93.13% <100.00%> (+0.01%) ⬆️
maven-3.9.14-java-21-windows-11-arm 91.56% <100.00%> (+0.01%) ⬆️
maven-3.9.14-java-25-ubuntu-24.04 93.13% <100.00%> (+0.01%) ⬆️
maven-3.9.6-java-17-ubuntu-24.04 93.13% <100.00%> (+0.01%) ⬆️
maven-4.0.0-rc-5-java-17-ubuntu-24.04 93.13% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...avenplugin/dependencies/aether/AetherResolver.java 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ascopes
ascopes merged commit 95e2aff into ascopes:main Apr 8, 2026
15 checks passed
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.

2 participants