[CONJ-77] Method getBinaryStream() on Blob's throws Out of range (position > stream size) Created: 2013-11-19 Updated: 2014-10-24 Resolved: 2014-10-21 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | None |
| Affects Version/s: | 1.1.5 |
| Fix Version/s: | 1.1.8 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Max Larsson | Assignee: | Massimo Siani (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
See the attached test. This issue describes a different behavior than the If a table with a Blob column has the value of an empty string stored, it can't be restored with the getBinaryStream method of the Blob, because it throws |
| Comments |
| Comment by Jochen Wiedmann [ 2014-02-20 ] |
|
Attaching a proposed patch. (Includes test case.) |
| Comment by Jochen Wiedmann [ 2014-02-20 ] |
|
Fortunately, a patch seems trivial. The method public InputStream getBinaryStream(final long pos, final long length) doesn't take into account that pos is 1-based. In other words, it is sufficient to change if (pos > actualSize) { throw SQLExceptionMapper.getSQLException("Out of range (position > stream size)"); }to if (pos-1 > actualSize) { throw SQLExceptionMapper.getSQLException("Out of range (position > stream size)"); } (See attachment CONJ77.patch, which includes the test case from BlobTest.java.) |
| Comment by Cedric [ 2014-10-15 ] |
|
I need this correction before next week and I see that 1.1.8 version is not released at this moment. Is it possible for you to attach mariadb connector binary files including this patch ? Thanks a lot for your work ! |
| Comment by Massimo Siani (Inactive) [ 2014-10-16 ] |
|
I attached a snapshot that contains some more fixes than just this one. As far as I know, this is very close to 1.1.8, contains the closed issues and most of the 'in review' ones, too. Or, I can just apply the patch for |
| Comment by Cedric [ 2014-10-16 ] |
|
Perfect ! Thanks a lot. This is more than I need. |
| Comment by Cedric [ 2014-10-24 ] |
|
Unfortunately I now get the error detailled in If not is it possible to do it ? ... Thank you ! |
| Comment by Massimo Siani (Inactive) [ 2014-10-24 ] |
|
Replaced with the latest snapshot. |
| Comment by Cedric [ 2014-10-24 ] |
|
Thanks ! It works fine ! |