java.io.RandomAccessFile.readLine() no longer calls read()

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P3
    • tbd
    • Affects Version/s: 25
    • Component/s: core-libs

      There has been a change in the behaviour of RandomAccessFile in Java 25. Before Java 25, a call to RandomAccessFile.readLine() would call read() on that same instance. However, starting Java 25, that no longer seems to be the case. This has an unforeseen impact on subclasses of RandomAccessFile.

      Attached is a reproducer which trivially reproduces an issue where a subclass of RandomAccessFile eagerly reads and buffers the file content to return that buffered content from calls to read(). However, since readLine() no longer calls read(), the call to readLine() ends up returning null (even when there is buffered content in the subclass).

      The attached reproducer completes normally in Java 24 but fails on Java 25.

      This looks a side effect of the change done in JDK-8361640.

            Assignee:
            Brian Burkhalter
            Reporter:
            Jaikiran Pai
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: