Exception while serializable NULL value (CacheModel)
----------------------------------------------------
Key: IBATIS-34
URL: http://nagoya.apache.org/jira/browse/IBATIS-34
Project: iBatis for Java
Type: Bug
Components: SQL Maps
Versions: 2.0.8
Environment: Cache turn on: <settings cacheModelsEnabled="true" />
Cache model:
<cacheModel id="ActionCacheModel" type="LRU" readOnly="false" serialize="true">
...
</cacheModel>
Reporter: Alexander Dederer
Priority: Critical
Method addObject craches when trying serializate null value.
INFO:
SQL request return empty ResultSet. CacheModel.java trying caching null value
througth Serializable is serialize variable is TRUE and craches with Exception.
To resolve this bug nedeed changes in addObject and getObject methods:
/* com.ibatis.sqlmap.engine.cache.CacheModel.addObject */
300 if (null == value) value = NULL_OBJECT;
301 if (serialize && !readOnly && value != null) {
to:
300 if (null == value) value = NULL_OBJECT;
301 if (serialize && !readOnly && value != NULL_OBJECT) {
/* com.ibatis.sqlmap.engine.cache.CacheModel.getObject */
270 if (serialize && !readOnly && value != null) {
to:
270 if (serialize && !readOnly && (value != NULL_OBJECT && value != null)) {
and finally return realy null referene when founded NULL_OBJECT in the cache:
289 return value;
to:
289 return value == NULL_OBJECT ? null : value;
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira