arminw      2005/12/31 11:07:21

  Modified:    src/java/org/apache/ojb/broker/core Tag: OJB_1_0_RELEASE
                        QueryReferenceBroker.java
  Log:
  enhance warn message, this part should be fixed because it's responsible for 
OJB-82
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.17.2.18 +35 -32    
db-ojb/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
  
  Index: QueryReferenceBroker.java
  ===================================================================
  RCS file: 
/home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java,v
  retrieving revision 1.17.2.17
  retrieving revision 1.17.2.18
  diff -u -r1.17.2.17 -r1.17.2.18
  --- QueryReferenceBroker.java 21 Dec 2005 22:25:00 -0000      1.17.2.17
  +++ QueryReferenceBroker.java 31 Dec 2005 19:07:20 -0000      1.17.2.18
  @@ -56,6 +56,7 @@
   import org.apache.ojb.broker.util.collections.RemovalAwareSet;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
  +import org.apache.commons.lang.SystemUtils;
   
   /**
    * Encapsulates 1:1 and 1:n references and collection references stuff.
  @@ -113,7 +114,7 @@
           try
           {
               result = (ManageableCollection) collectionClass.newInstance();
  -            
  +
               // now iterate over all elements and add them to the new 
collection
               // lifecycle events are disabled
               iter = pb.getIteratorFromQuery(query, cld);
  @@ -151,10 +152,12 @@
                       else
                       {
                           //warn the user
  -                        log.warn("Candidate object ["+candidate
  -                                    +"] class 
["+candidate.getClass().getName()
  -                                    +"] is not a subtype of 
["+itemClass.getName()
  -                                    +"] or any type of proxy. NOT INCLUDED 
in result collection");
  +                        if(log.isEnabledFor(Logger.WARN)) 
log.warn(SystemUtils.LINE_SEPARATOR
  +                                + "Candidate object ["+candidate + "]"
  +                                +" of "+candidate.getClass() + 
SystemUtils.LINE_SEPARATOR
  +                                +"is not a subtype of "+itemClass +" or any 
type of proxy - e.g. this can be the result of a"
  +                                + SystemUtils.LINE_SEPARATOR +"'declared' 
extent in "+itemClass + "."
  +                                + " This can cause side-effects and will NOT 
INCLUDED in the current generated collection result");
                       }
                       if (prefetchProxies && (handler != null)
                               && (cld.getProxyPrefetchingLimit() > 0)
  @@ -227,7 +230,7 @@
               fullSize = size; // use size of result
           }
           query.fullSize(fullSize);
  -        
  +
           return result;
       }
   
  @@ -289,7 +292,7 @@
           return (Collection) 
getCollectionByQuery(RemovalAwareCollection.class, query, lazy);
       }
   
  -    
  +
       private Class getCollectionTypeClass(CollectionDescriptor cds) throws 
PersistenceBrokerException{
           // BRJ: do not use RemovalAwareCollection for m:n relationships
           // see 
http://db.apache.org/ojb/docu/guides/basic-technique.html#Mapping+m%3An+associations
  @@ -319,8 +322,8 @@
           }
           return collType;
       }
  -    
  -    
  +
  +
       /**
        * @return true if this is the first task for the given 
ObjectReferenceDescriptor
        */
  @@ -398,7 +401,7 @@
       {
           PersistentField refField;
           Object refObj = null;
  -        
  +
           if (forced || rds.getCascadeRetrieve())
           {
               pb.getInternalCache().enableMaterializationCache();
  @@ -414,12 +417,12 @@
                   else if ( pb.serviceObjectCache().lookup(id) != null )
                   {
                       refObj = pb.doGetObjectByIdentity(id);
  -                    if (rds.isSuperReferenceDescriptor()) 
  +                    if (rds.isSuperReferenceDescriptor())
                       {
                           // walk the super-references
                           ClassDescriptor superCld = 
cld.getRepository().getDescriptorFor(rds.getItemClass());
                           retrieveReferences(refObj, superCld, false);
  -                        retrieveCollections(refObj, superCld, false);        
                
  +                        retrieveCollections(refObj, superCld, false);
                       }
                   }
                   else if ((m_retrievalTasks != null)
  @@ -463,7 +466,7 @@
               }
           }
       }
  -    
  +
       /**
        * Retrieve a single Reference.
        * This implementation retrieves a referenced object from the data 
backend
  @@ -502,7 +505,7 @@
                                   rds, rds.getProxyPrefetchingLimit());
                       }
                   }
  -                
  +
   
                   pb.getInternalCache().disableMaterializationCache();
               }
  @@ -511,7 +514,7 @@
                   pb.getInternalCache().doLocalClear();
                   throw e;
               }
  -        
  +
       }
   
       /**
  @@ -550,7 +553,7 @@
               classToPrefetch = saveClassToPrefetch;
           }
       }
  -    
  +
       /**
        * Retrieve all References
        *
  @@ -664,12 +667,12 @@
               */
               // referencedProxy = 
getClassDescriptor(referencedClass).getDynamicProxyClass();
               //referencedProxy = rds.getItemClass(); 
  -            
  +
               /*
  -             * andrew.clute:
  -             * With proxy generation now handled by the ProxyFactory 
implementations, the class of the Item
  -             * is now the nessecary parameter to generate a proxy.
  -             */
  +            * andrew.clute:
  +            * With proxy generation now handled by the ProxyFactory 
implementations, the class of the Item
  +            * is now the nessecary parameter to generate a proxy.
  +            */
               baseClassForProxy = rds.getItemClass();
           }
           else
  @@ -705,7 +708,7 @@
               return pb.doGetObjectByIdentity(id);
           }
       }
  -    
  +
       /**
        * Retrieve a single Collection on behalf of <b>obj</b>.
        * The Collection is retrieved only if <b>cascade.retrieve is true</b>
  @@ -721,7 +724,7 @@
       {
           doRetrieveCollection(obj, cld, cds, forced, cds.isLazy());
       }
  -    
  +
       /**
        * Retrieve a single Proxied Collection on behalf of <b>obj</b>.
        * The Collection is retrieved only if <b>cascade.retrieve is true</b>
  @@ -737,7 +740,7 @@
       {
           doRetrieveCollection(obj, cld, cds, forced, true);
       }
  -    
  +
       private void doRetrieveCollection(Object obj, ClassDescriptor cld, 
CollectionDescriptor cds, boolean forced, boolean lazyLoad)
       {
           if (forced || cds.getCascadeRetrieve())
  @@ -939,7 +942,7 @@
       {
           doRetrieveCollections(newObj, cld, forced, false);
       }
  -    
  +
       /**
        * Retrieve all Collection attributes of a given instance, and make all 
of the Proxy Collections
        *
  @@ -952,7 +955,7 @@
       {
           doRetrieveCollections(newObj, cld, forced, true);
       }
  -    
  +
       private void doRetrieveCollections(Object newObj, ClassDescriptor cld, 
boolean forced, boolean forceProxyCollection) throws PersistenceBrokerException
       {
           Iterator i = cld.getCollectionDescriptors().iterator();
  @@ -1014,12 +1017,12 @@
   
       class PBMaterializationListener extends PBPrefetchingListener implements 
MaterializationListener
       {
  -        private IndirectionHandler _listenedHandler;        
  +        private IndirectionHandler _listenedHandler;
   
           PBMaterializationListener(Object owner,
  -                HashMap retrievalTasks, Object key, int limit)
  +                                  HashMap retrievalTasks, Object key, int 
limit)
           {
  -            super(owner, retrievalTasks, key, limit);            
  +            super(owner, retrievalTasks, key, limit);
           }
   
           protected void addThisListenerTo(Object owner)
  @@ -1074,7 +1077,7 @@
           protected Object _key;
   
           PBPrefetchingListener(Object owner, HashMap retrievalTasks,
  -                Object key, int limit)
  +                              Object key, int limit)
           {
               _retrievalTasks = retrievalTasks;
               _key = key;
  @@ -1152,7 +1155,7 @@
           CollectionProxyDefaultImpl _listenedCollection;
   
           PBCollectionProxyListener(Object owner,
  -               HashMap retrievalTasks, CollectionDescriptor key, int limit)
  +                                  HashMap retrievalTasks, 
CollectionDescriptor key, int limit)
           {
               super(owner, retrievalTasks, key, limit);
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to