elharo commented on code in PR #2368:
URL: https://github.com/apache/maven/pull/2368#discussion_r2102751676
##########
its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/AbstractDependencyMojo.java:
##########
@@ -222,11 +222,7 @@ private String calcChecksum(File jarFile) throws
IOException, NoSuchAlgorithmExc
MessageDigest digester = MessageDigest.getInstance("SHA-1");
try (FileInputStream is = new FileInputStream(jarFile)) {
- DigestInputStream dis = new DigestInputStream(is, digester);
-
- for (byte[] buffer = new byte[1024 * 4]; dis.read(buffer) >= 0; ) {
- // just read it
- }
+ new DigestInputStream(is, digester).read(new byte[1024 * 4]); //
only read required.
Review Comment:
No, this is incorrect. There's no guarantee this read will read as much as
is needed
--
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]