jdbc1.AbstractJdbc1Statement.setBinaryStream bug and patch - Mailing list pgsql-bugs

From Martin Holz
Subject jdbc1.AbstractJdbc1Statement.setBinaryStream bug and patch
Date
Msg-id 200401071928.17842.holz@fiz-chemie.de
Whole thread Raw
Responses Re: jdbc1.AbstractJdbc1Statement.setBinaryStream bug and
Re: jdbc1.AbstractJdbc1Statement.setBinaryStream bug and
List pgsql-bugs
Hello,

org.postgresql.jdbc1.AbstractJdbc1Statement.setBinaryStream()
in postgresql 7.4.1 wrongly assumes, that
java.io.InputStream.read(byte[] b,int offset,int len )
will always read len bytes. InputStream only guarantees to
return at least 1 byte per call. The attached patch solves the bug.

Btw. setBinaryStream() should really throw an SQLException, if
in can not read as many bytes as expected from the InputStream.
Otherwise the application might silently loss data.

Regards
        Martin

--
Martin Holz     <holz@fiz-chemie.de>

Softwareentwicklung / Vernetztes Studium - Chemie
FIZ CHEMIE Berlin
Franklin Str. 11
D-10587 Berlin

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Crash while recovering database index relation
Next
From: Seum-Lim Gan
Date:
Subject: Re: dyntest.pgc not working in 7.4 ?