On Wed, 23 Aug 2023 15:01:06 GMT, Vyom Tewari <[email protected]> wrote:
>> With the current implementation of BufferedOutputStream if you close the
>> stream and try to write to the closed stream BufferedOutputStream does not
>> throw an IOException until the internal buffer is full. To fix this issue i
>> added a private "ensureOpen" function to BufferedOutputStream which will
>> check if the underline stream is open. If the underline stream is closed
>> "ensureOpen" will throw the IOException.
>
> Vyom Tewari has updated the pull request incrementally with one additional
> commit since the last revision:
>
> make the isOpen method to package private
test/jdk/java/io/BufferedOutputStream/WriteAfterClose.java line 61:
> 59: public static void main(String argv[]) throws IOException {
> 60: var file = new File(System.getProperty("test.dir", "."),
> "test.txt");
> 61: file.createNewFile();
Why not instead do something like?:
var dir = new File(System.getProperty("test.dir", "."));
File file = File.createTempFile("x", "y", dir);
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15361#discussion_r1303575171