On Thu, 29 Oct 2026 17:56:27 GMT, Erik Gahlin <[email protected]> wrote:
> Could I have a review of a PR that fixes a bug in the JFR instrumentation of
> RandomAccessFile?
>
> The problem is that readLine() may produce an event with non-zero number of
> bytes read and EOF at the same time. To ensure that we get the correct number
> of bytes, we can't just take the length of the returned String, since
> readLine() may read one ('\n') or two bytes ('\r\n') for line endings.
>
> I added a test that verifies that readLine() returns the same result and
> leaves the file pointer at the same position with or without JFR enabled.
>
> Testing: jdk-tier2 + test/jdk/jdk/jfr
>
> Thanks
> Erik
>
>
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK
> Interim AI Policy](https://openjdk.org/legal/ai).
This pull request has now been integrated.
Changeset: acad8bef
Author: Erik Gahlin <[email protected]>
URL:
https://git.openjdk.org/jdk/commit/acad8bef5ed6591dd7a2ab9054af5e1e1cf0e924
Stats: 211 lines in 4 files changed: 168 ins; 27 del; 16 mod
8396523: JFR: Incorrect byte count recorded for RandomAccessFile::readLine
Reviewed-by: alanb, vyazici
-------------
PR: https://git.openjdk.org/jdk/pull/33637