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

Martin Desruisseaux martin.desruisseaux at geomatys.fr
Thu Jun 14 17:09:16 UTC 2012

Le 14/06/12 18:59, Phil Race a écrit :
> Perhaps the real issue is that the interface Closeable should not have 
> made
> claims about what all the existing close methods it was added to do in 
> all cases.
> FileInputStream.close() made no such claim.

AutoCloseable makes no such claim, but Closeable does. If the intend was 
to support ARM without complying with the idempotent criterion, then 
ImageInputStream should have extended AutoCloseable rather than Closeable...

But anyway, while FileCacheImageInputStream throws explicitly an 
IOException, the NullPointerException in FileCacheOutputStream looks an 
oversight... To be consistent, it seems to me it should either do 
nothing if already closed, or invoke the checkClosed() to throws an 
IOException like FileCacheImageInputStream does...


More information about the 2d-dev mailing list