[jboss-cvs] JBossCache/src/org/jboss/cache/aop ...

Ben Wang bwang at jboss.com
Sun Aug 6 22:41:22 EDT 2006


  User: bwang   
  Date: 06/08/06 22:41:22

  Modified:    src/org/jboss/cache/aop  Tag: Branch_JBossCache_1_4_0
                        TreeCacheAopDelegate.java
  Log:
  JBCACHE-728 Allows private default constructor
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.74.2.4  +12 -6     JBossCache/src/org/jboss/cache/aop/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/TreeCacheAopDelegate.java,v
  retrieving revision 1.74.2.3
  retrieving revision 1.74.2.4
  diff -u -b -r1.74.2.3 -r1.74.2.4
  --- TreeCacheAopDelegate.java	28 Jun 2006 20:18:29 -0000	1.74.2.3
  +++ TreeCacheAopDelegate.java	7 Aug 2006 02:41:22 -0000	1.74.2.4
  @@ -15,6 +15,7 @@
   import org.jboss.cache.marshall.MethodCallFactory;
   import org.jboss.cache.marshall.MethodDeclarations;
   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.references.FieldPersistentReference;
   import org.jboss.cache.Fqn;
  @@ -26,6 +27,7 @@
   import org.jgroups.blocks.MethodCall;
   
   import java.lang.reflect.Field;
  +import java.lang.reflect.Constructor;
   import java.util.Map;
   import java.util.HashMap;
   import java.util.Iterator;
  @@ -122,7 +124,9 @@
   
         if (Advised.class.isAssignableFrom(clazz)) {
            try {
  -            obj = clazz.newInstance();
  +            Constructor ctr = clazz.getDeclaredConstructor(null);
  +            SecurityActions.setAccessible(ctr);
  +            obj = ctr.newInstance(null);
               // TODO Need to populate the object from the cache as well.
            }
            catch(Exception e) {
  @@ -412,6 +416,7 @@
         Map subPojoMap = new HashMap();
         boolean hasFieldAnnotation = hasAnnotation(obj.getClass(), ((Advised)obj)._getAdvisor(), type);
   
  +      boolean todo = false;
         for (Iterator i = type.getFieldsIterator(); i.hasNext();) {
            Field field = (Field) i.next();
            Object value = null;
  @@ -422,11 +427,6 @@
               throw new CacheException("field access failed", e);
            }
            CachedType fieldType = cache_.getCachedType(field.getType());
  -         // check for non-replicatable types
  -         if(CachedType.isPrimitiveNonReplicatable(field))
  -         {
  -            continue;
  -         }
   
            if(hasFieldAnnotation)
            {
  @@ -436,6 +436,12 @@
               }
            }
   
  +         // check for non-replicatable types
  +         if(CachedType.isPrimitiveNonReplicatable(field))
  +         {
  +            continue;
  +         }
  +
            // we simply treat field that has @Serializable as a primitive type.
            if (fieldType.isImmediate() ||
                    (hasFieldAnnotation &&
  
  
  



More information about the jboss-cvs-commits mailing list