You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "CrazyHZM (via GitHub)" <gi...@apache.org> on 2023/05/16 14:54:10 UTC

[GitHub] [maven] CrazyHZM commented on a diff in pull request #1108: [MNG-7780] DefaultArtifact.equals throws NullPointerException if o.version is null

CrazyHZM commented on code in PR #1108:
URL: https://github.com/apache/maven/pull/1108#discussion_r1195294903


##########
maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java:
##########
@@ -314,7 +314,9 @@ public boolean equals(Object o) {
             return false;
         } else if (!a.getArtifactId().equals(artifactId)) {
             return false;
-        } else if (!a.getVersion().equals(version)) {
+        } else if (a.getVersion() != null && !a.getVersion().equals(version)) {
+            return false;
+        } else if (a.getVersion() == null && version != null) {

Review Comment:
   Agreed. I have revised this part.



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org