[jboss-cvs] JBossCache/src/org/jboss/cache/aop ...
Ben Wang
bwang at jboss.com
Thu Nov 16 01:44:26 EST 2006
User: bwang
Date: 06/11/16 01:44:26
Modified: src/org/jboss/cache/aop Tag: Branch_JBossCache_1_4_0
TreeCacheAopDelegate.java
Log:
JBCACHE-847 removeObject didn't restor Collection class instance.
Revision Changes Path
No revision
No revision
1.74.2.8 +22 -0 JBossCache/src/org/jboss/cache/aop/Attic/TreeCacheAopDelegate.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TreeCacheAopDelegate.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/aop/Attic/TreeCacheAopDelegate.java,v
retrieving revision 1.74.2.7
retrieving revision 1.74.2.8
diff -u -b -r1.74.2.7 -r1.74.2.8
--- TreeCacheAopDelegate.java 16 Nov 2006 02:53:59 -0000 1.74.2.7
+++ TreeCacheAopDelegate.java 16 Nov 2006 06:44:26 -0000 1.74.2.8
@@ -17,6 +17,7 @@
import org.jboss.cache.aop.util.AopUtil;
import org.jboss.cache.aop.util.SecurityActions;
import org.jboss.cache.aop.collection.AbstractCollectionInterceptor;
+import org.jboss.cache.aop.collection.CollectionInterceptorUtil;
import org.jboss.cache.Fqn;
import org.jboss.cache.CacheException;
import org.jboss.cache.GlobalTransaction;
@@ -590,10 +591,31 @@
CachedType type = cache_.getCachedType(clazz);
for (Iterator i = type.getFieldsIterator(); i.hasNext();) {
Field field = (Field) i.next();
+
+ Object value = null;
+ try {
+ value=field.get(result);
+ }
+ catch(IllegalAccessException e) {
+ throw new CacheException("field access failed", e);
+ }
+
CachedType fieldType = cache_.getCachedType(field.getType());
if (!fieldType.isImmediate()) {
_removeObject(new Fqn(fqn, field.getName()), removeCacheInterceptor, evict);
}
+
+ // Check for Collection field so we need to restore the original reference.
+ if(value instanceof ClassProxy)
+ {
+ Interceptor interceptor = CollectionInterceptorUtil.getInterceptor((ClassProxy)value);
+ Object ori = ((AbstractCollectionInterceptor)interceptor).getOriginalInstance();
+ try {
+ field.set(result, ori);
+ } catch (IllegalAccessException e) {
+ throw new CacheException("field access failed", e);
+ }
+ }
}
// batch remove
More information about the jboss-cvs-commits
mailing list