]
Marcin Kobylarz commented on HHH-2142:
--------------------------------------
Hibernate 3.3.2 still suffers from this bug.
Could authors patch this, since solution is already known?
PersistentMap.remove() may return UNKNOWN object that can cause
ClassCastException in client code
-------------------------------------------------------------------------------------------------
Key: HHH-2142
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2142
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.2.0.cr5
Reporter: Andrzej Miazga
Here is some code in Hibernate 3.2.0cr5 that may cause this behaviour. I'm not sure
if this is a bug but it surely affects the client code.
AbstractPersistentCollection:
protected Object readElementByIndex(Object index) {
if (!initialized) {
...
return persister.getElementByIndex( entry.getLoadedKey(), index, session, owner );
}
...
return UNKNOWN;
}
PersistentMap (extends AbstractPersistentCollection):
public Object put(Object key, Object value) {
if ( isPutQueueEnabled() ) {
Object old = readElementByIndex( key );
queueOperation( new Put( key, value, old ) );
return old;
}
...
So, there is a possibility to return UNKNOWN instance (MarkerObject) to the client code
as the result of Map.put().
In version 3.1.3 this worked fine, but the implementation was different:
public Object put(Object key, Object value) {
Object old = isPutQueueEnabled() ?
readElementByIndex(key) : UNKNOWN;
if ( old==UNKNOWN ) {
write();
return map.put(key, value);
}
...
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: