| Bug #34677 | Blob.truncate throws exception with len < 1, should be < 0 | ||
|---|---|---|---|
| Submitted: | 19 Feb 22:33 | Modified: | 1 Mar 13:32 |
| Reporter: | Robert Nice | ||
| Status: | Closed | ||
| Category: | Connector/J | Severity: | S2 (Serious) |
| Version: | 5.1.5 | OS: | Any |
| Assigned to: | Target Version: | ||
| Tags: | truncate, BLOB | ||
| Triage: | D2 (Serious) / R2 (Low) / E2 (Low) | ||
[20 Feb 17:56]
Tonci Grgin
Hi Robert and thanks for spotting this! Thanks for your interest in MySQL.
[20 Feb 18:13]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/42673
[27 Feb 18:12]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/43086
[1 Mar 13:32]
MC Brown
A note has been added to the 5.1.6 changelog: It was not possible to truncate a BLOB using Blog.truncate() when using 0 as an argument.

Description: Can't truncate a blob to zero bytes. Javadoc: * @exception SQLException if there is an error accessing the * <code>BLOB</code> value or if len is less than 0 But Code says: if (len < 1) { throw SQLError.createSQLException("\"len\" argument can not be < 1.", SQLError.SQL_STATE_ILLEGAL_ARGUMENT); } Should be < 0 if own Javadoc (and expectations) are to be believed. How to repeat: myblob.truncate(0L); Suggested fix: Change < 1 to < 0