gnodet-bot commented on code in PR #2209:
URL: https://github.com/apache/maven-resolver/pull/2209#discussion_r4312538598


##########
maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultArtifactResolver.java:
##########
@@ -307,6 +307,19 @@ private List<ArtifactResult> resolve(
 
                     artifact = artifact.setVersion(versionResult.getVersion());
 
+                    if (artifact.getVersion() == null || 
artifact.getVersion().isEmpty()) {

Review Comment:
   The `== null` check is dead code: `DefaultArtifact` normalizes `null` to 
`""` via `emptify()` in all constructors, and `AbstractArtifact.setVersion()` 
handles the `null` case by returning `this` unchanged (version stays `""`). 
`getVersion()` never returns `null`.
   
   Also, `isEmpty()` misses whitespace-only versions (e.g. `" "`) that would 
still produce an invalid path in the local path composer. Use 
`trim().isEmpty()` for completeness (Java 8-compatible).
   
   ```suggestion
                       if (artifact.getVersion().trim().isEmpty()) {
   ```



-- 
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