[OJB-developers] another bug in PersistenceBrokerImpl
Brought to you by:
thma
From: Georg S. <ge...@me...> - 2002-04-24 09:40:47
|
Hi Thomas, I think there is another bug in PersistenceBrokerImpl in the method private Object getReferencedObject(Object obj, ObjectReferenceDescriptor rds, ClassDescriptor mif) .... referencedProxy = rds.getItemProxyClass(); if (rds.isLazy()) { referencedProxy = mif.getDynamicProxyClass(); } Let's say we have object A which has a reference to object B (with a referenceProxy) What this is actually doing (in case of a referenceProxy i.e. rds.isLazy is true) is to set referencedProxy to a proxy of object A (mif is the ClassDescriptor of A) instead of object B. I think the correct lines should be referenceProxy=null; if (rds.isLazy()) { referencedProxy = rds.getItemProxyClass(); } It was quite difficult to find this bug because the actual exception that finds its way into the application is a NoSuchElementException, when the real problem was an IllegalArgumentException when trying to set the reference field in object A which should hold an object B (or a corresponding proxy) to a proxy corresponding to object A due to the bug mentioned above. The thing is that in the method retrieveReferences all Throwables are caught and then rethrown as a PersistenceBrokerException. The method next() in RsIterator then catches all Exceptions and rethrows them as a NoSuchElementException. By that time all connection to the initial IllegalArgumentException is lost. Regards Georg |