RFR: 8284638: store skip buffers in InputStream Object [v7]

jmehrens duke at openjdk.java.net
Mon Apr 18 20:11:32 UTC 2022


On Fri, 15 Apr 2022 18:56:37 GMT, XenoAmess <duke at openjdk.java.net> wrote:

>> @jmehrens what about this then?
>> I think it safe now(actually this mechanism is learned from Reader)
>
> XenoAmess has updated the pull request incrementally with one additional commit since the last revision:
> 
>   change to liach operation.

> @jmehrens what about this then? I think it safe now(actually this mechanism is learned from Reader)

Reader uses a lock object and it appears that InputStream locks on this (per make/reset)  I would assume now that you have some object member fields you need to hold some lock while accessing those.  Even though single thread access would be the expected case.

Not related but, it looks like the static buffer issue has come up a few times.  Maybe time to add a test to: https://github.com/openjdk/jdk/blob/master/test/jdk/java/io/InputStream/Skip.java that would fail if the skip buffer is static?

Not really the primary issue but, it seems questionable to me that we don't have to fill the skip buffer with zeros after the last read.  That way any sensitive information that was skipped would also be forgotten.  Matching with Reader seems more important for now.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5872


More information about the core-libs-dev mailing list