elharo opened a new issue, #135:
URL: https://github.com/apache/maven-dependency-tree/issues/135

   ## Summary
   Both graph builders call `getDependencyArtifact(child.getDependency())` 
unconditionally for every child node. If a child node has a null `Dependency` 
(possible for nodes produced/omitted by certain resolver transformers), this 
throws a `NullPointerException` instead of being handled.
   
   ## Affected code
   - 
`src/main/java/org/apache/maven/shared/dependency/graph/internal/DefaultDependencyCollectorBuilder.java:225-231`
 — `getDependencyArtifact(child.getDependency())`
   - 
`src/main/java/org/apache/maven/shared/dependency/graph/internal/DefaultDependencyGraphBuilder.java:152-159`
 — `getDependencyArtifact(child.getDependency())`
   
   ## Note
   The same code paths carefully null-guard `node.getDependency()` when reading 
`optional`/`exclusions` (e.g. 
`DefaultDependencyCollectorBuilder.java:187,192`), which is inconsistent with 
the unconditional child handling.
   
   ## Suggested fix
   Null-guard `child.getDependency()` and skip or substitute the artifact 
accordingly, or document that children are guaranteed to carry a `Dependency` 
and fail with a clearer message.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to