On Thu, 9 Jan 2025 17:32:39 GMT, Severin Gehwolf <sgehw...@openjdk.org> wrote:
> During code review of > [JDK-8346239](https://bugs.openjdk.org/browse/JDK-8346239) a few comments > were made after the PR integrated. This follow-up patch cleans this up and > adds a unit test for the `JimageDiffGenerator` class. > > Testing: > - [ ] GHA > - [x] tools/jlink tests (including the new one). > > Thoughts? src/jdk.jlink/share/classes/jdk/tools/jlink/internal/runtimelink/JimageDiffGenerator.java line 131: > 129: int bytesRead1, bytesRead2; > 130: try (is1; is2) { > 131: while ((bytesRead1 = is1.readNBytes(buf1, 0, buf1.length)) > != 0) { If `in1` is exactly 1024 bytes, and `in2` is those same bytes plus one extra byte (1025 bytes), this method will return a false positive. Probably just want `while (true)` here, then read both `in1` and `in2`, then check results. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23014#discussion_r1909219888