cstamas commented on code in PR #508:
URL: 
https://github.com/apache/maven-build-cache-extension/pull/508#discussion_r3608846672


##########
src/main/java/org/apache/maven/buildcache/checksum/MavenProjectInput.java:
##########
@@ -838,15 +838,12 @@ private DigestItem resolveArtifact(final Dependency 
dependency)
             return DtoUtils.createDigestedFile(artifact, hash);
         }
 
-        // Handle special dependency types that have implicit classifiers
-        String classifier = dependency.getClassifier();
-        String extension = null;
-
-        // test-jar type requires "tests" classifier and "jar" extension
-        if ("test-jar".equals(dependency.getType()) && (classifier == null || 
classifier.isEmpty())) {
-            classifier = "tests";
-            extension = "jar";
-        }
+        ArtifactHandler handler = 
artifactHandlerManager.getArtifactHandler(dependency.getType());
+        String classifier = dependency.getClassifier() == null
+                        || dependency.getClassifier().trim().isEmpty()
+                ? handler.getClassifier()
+                : dependency.getClassifier();
+        String extension = handler.getExtension();

Review Comment:
   This is wrong, Maven ArtifactHandlerManager never returns null:
   
https://github.com/apache/maven/blob/maven-3.9.x/maven-core/src/main/java/org/apache/maven/artifact/handler/manager/DefaultArtifactHandlerManager.java#L41
   
   The null protection may be due tests/mocks?



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