Hi.

SQLEngine.load() may throw a PersistenceException when it catches a 
SQLException. TransactionContext.load() contains the following code:

----+----+----+----+----
try {
     // ....
     entry = addObjectEntry( oid, object );
     oid = engine.load( this, oid, ...);
     // ....
}
catch (... except) {
     removeObjectEntry( object );
     throw except;
}
----+----+----+----+----

There are "catch"-statements for ObjectNotFoundException, 
LockNotGrantedException and ClassNotPersistenceCapableException. But not for 
PersistenceException. So the PersistenceException will be thrown to the client, 
which will most likely call "rollback" after an exception.

The impact of the bug is the following: "db.rollback" will throw an 
IllegalStateException in LockEngine.TypeInfo.assure(), complaining that the 
transaction does not hold the read lock.

Of course, the transaction is not holding a lock, because the "load" failed :-)

IMHO, the above catch-statements should be changed to:

----+----+----+----+----
catch (PersistenceException except) {
     removeObjectEntry( object );
     throw except;
}
----+----+----+----+----

Martin

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to