spring-projects/spring-framework — pull request #463 by marschall (2014-02-11 17:02:23+00:00)
Title: SPR-11415 Call free() on Blob and Clob

Since Java 1.6/JDBC 4 `ava.sql.Blob` and `java.sql.Clob` have
a `#free()` method to release the resources that they hold. They should
be called as early as possible because otherwise the objects remain
valid for at least the duration of the transaction in which they are
created. `DefaultLobHandler` currently creates `Blob`s and `Clob`s and
throws them away without calling `#free()`.

* change `#getBlobAsBytes()` and `#getClobAsString()` in
`DefaultLobHandler` to call `#free()`

There are more methods in `DefaultLobHandler` where `Blob`s and `Clob`s
are used without calling free. However they return a stream so we
probably shouldn’t call `#free()` before being done reading. This is a
bit of an issues because the `Blob` and `Clob` are out of scope for
calling code. `OracleLobHandler` also uses `Blobs` and `Clob`s are used
without calling `#free()` but since the class is deprecated I did not
update it.

I did sign the Contributor License Agreement.

Issue: SPR-11415
https://jira.springsource.org/browse/SPR-11415