db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@debrunners.com>
Subject Re: closing ByteArrayInputStream problem (Re: [jira] Commented: (DERBY-596) jdbcapi/resultsetStream.java fails in DerbyNetClient Framework)
Date Thu, 06 Oct 2005 16:23:57 GMT
TomohitoNakayama wrote:

> Hello.
> 
> I think we can ignore test which corresponds to differece of 8a9 .
> 
> I found that InputStream was not closed .
> This is not correct in spec of java.sql.ResultSet .
> 
> However, the InputStream was exactly ByteArrayInputStream as shown in
> error message .
> 
>>> > FAIL - stream was not closed after a get*() call. class
>>> java.io.ByteArrayInputStream
> 
> 
> And Java API spec says that closing ByteArrayInputStream has no effect .
> http://java.sun.com/j2se/1.4.2/docs/api/java/io/ByteArrayInputStream.html
>    Closing a ByteArrayInputStream has no effect.
>     The methods in this class can be called after the stream has been
> closed without generating an IOException.
> 
> Then the behavior of the program does not differ , wheter InputStream
> was closed or not.
> 
> I think no problem here .

I think there is a problem, the JDBC spec says the stream is closed
after a getXXX, and in this case, because the close has no affect it
does not appear closed to the application. Thus the application may
continue to use the stream when it shouldn't and that behaviour
might/will change in the future, or may not be consistent now depending
on the stream implementation returned by the driver.

I seem to remember that embedded worked around this by
wrapping/extending  ByteArrayInputStream so that the close did close the
stream.

Dan.



Mime
View raw message