cuishuang opened a new pull request, #16452: URL: https://github.com/apache/dubbo/pull/16452
## What is the purpose of the change? Fix incorrect MD5 calculation in `Bytes.getMD5(InputStream)` and `Bytes.getMD5(File)`. The previous implementation used `InputStream.available()` to detect EOF and passed the entire buffer to `MessageDigest.update()`. For a final partial read, zero-filled bytes were included in the digest. Streams that report `available() == 0` while still containing readable data were also skipped. This change reads until `read()` returns `-1` and updates the digest with only the bytes actually read. GitHub issue: https://github.com/apache/dubbo/issues/16451 ## Checklist - [x] Make sure there is a [GitHub_issue](https://github.com/apache/dubbo/issues) field for the change. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit-test to verify your logic correction. If the new feature or significant change is committed, please remember to add sample in [dubbo samples](https://github.com/apache/dubbo-samples) project. - [x] Make sure gitHub actions can pass. [Why the workflow is failing and how to fix it?](../CONTRIBUTING.md) -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
