RFR: 8292327: java.io.EOFException in InflaterInputStream after JDK-8281962 [v2]
Alan Bateman
alanb at openjdk.org
Tue Aug 16 06:30:16 UTC 2022
On Mon, 15 Aug 2022 19:42:36 GMT, Volker Simonis <simonis at openjdk.org> wrote:
>> src/java.base/share/classes/java/util/zip/InflaterInputStream.java line 164:
>>
>>> 162: // fill() to avoid an EOF error if no more input is available and the
>>> 163: // next call to inflate will finish the inflation.
>>> 164: fill();
>>
>> We need to submit a bug against fill() too as it is not currently specified to throw when the input is at EOF.
>
> Not sure about this one? `fill()` is specified to throw an `IOException` and `EOFException` is an `IOException`. It probably depends on how you interpret the current "*if an I/O error has occurred*" description in the throws section.
>
> Do you propose to be more specific there and write something like "*if an I/O error has occurred or the end of the input buffer has been reached*"?
> Not sure about this one? `fill()` is specified to throw an `IOException` and `EOFException` is an `IOException`. It probably depends on how you interpret the current "_if an I/O error has occurred_" description in the throws section.
>
> Do you propose to be more specific there and write something like "_if an I/O error has occurred or the end of the input buffer has been reached_"?
Like many JDK 1.1 era APIs, InflaterInputStream is very under-specified. In this case, the protected fill method is begging us to specify how it behaves when the input is at EOF. An I/O error is surprising here as it sets the protected len field to indicate EOF. We can't change it after 25 years so we will need to specify existing behavior.
-------------
PR: https://git.openjdk.org/jdk/pull/9881
More information about the core-libs-dev
mailing list