[OpenJDK 2D-Dev] FileCacheImageOutputStream.close() is not idempotent

Phil Race philip.race at oracle.com
Thu Jun 14 23:58:34 UTC 2012


Just two lines down from where you propse to add super.close(),
seek(maxStreamPos) will then throw an exception.

BTW this fix will need a regression test. Also you should run the
existing reg. tests in this area.


On 6/14/12 1:51 PM, Martin Desruisseaux wrote:
> Le 14/06/12 22:36, Phil Race a écrit :
>> It looks as if the new proposed fix will mean cached data isn't 
>> flushed before you close
>> the stream ??
> I don't think so. The call to super.close() executes the following 
> code, which is declared in ImageInputStreamImpl (there is no close() 
> method in ImageOutputStreamImpl):
>     public void close() throws IOException {
>         checkClosed();
>         isClosed = true;
>     }
> There is apparently nothing else in the call to super.close(). 
> Furthermore, other implementations like FileImageOutputStream also 
> perform the same super.close() call first.
>     Martin

More information about the 2d-dev mailing list