jdbc1.AbstractJdbc1Statement.setBinaryStream bug and patch

From: Martin Holz <holz(at)fiz-chemie(dot)de>
To: pgsql-bugs(at)postgresql(dot)org
Subject: jdbc1.AbstractJdbc1Statement.setBinaryStream bug and patch
Date: 2004-01-07 18:28:17
Message-ID: 200401071928.17842.holz@fiz-chemie.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-jdbc

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(at)fiz-chemie(dot)de>

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

Attachment Content-Type Size
AbstractJdbc1Statement.java.diff text/x-diff 1.1 KB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Seum-Lim Gan 2004-01-07 19:51:23 Re: dyntest.pgc not working in 7.4 ?
Previous Message Tom Lane 2004-01-07 15:19:52 Re: Crash while recovering database index relation

Browse pgsql-jdbc by date

  From Date Subject
Next Message Conor Beverland 2004-01-07 18:39:51 getBytes() returning too much data
Previous Message Barry Lind 2004-01-07 17:25:53 Re: PreparedStatement parameters and mutable objects