Closed rleigh-codelibre closed 3 years ago
The ConverterTest.testname()
test fails here:
ImageIO.read(f);
The .read(f)
call fails because the stream f
was closed. [Because it was used by multiple J2KImageReader instances?]
When passing an open stream to J2KImageReader
, is it acceptable for the reader to close it, or does that responsibility lie with the caller which created it and passed it the stream (and is implicitly the owner of the stream)? Or is ownership of the stream fully transferred to the reader? It looks here like it breaks some fairly fundamental functionality of ImageIO, unless the unit test needs adjusting to take account of the changed behaviour?
/cc @melissalinkert @jmabrey
As suggested on a previous iteration of this change, you might try calling iis.flush()
instead of iis.close()
to see if that resolves memory issues without affecting tests (see https://github.com/jai-imageio/jai-imageio-jpeg2000/pull/2#issuecomment-76875274). Based upon the previous PR discussions, I'd assume that responsibility for closing the stream is with the caller and not the reader.
Agreed with @melissalinkert , it should not be closing something it didn't open.
I'm not doing work on this going forward. If anyone wants to pick this up, please feel free to do so.
See https://github.com/jai-imageio/jai-imageio-core/pull/2 for original PR.