Hi!
 
I've found a little bug in PersistenceBrokerImpl (latest CVS - downloaded 10 min ago), that can cause a NPE when storing:
 
    private Iterator getCollectionIterator(CollectionDescriptor cds, Object collectionOrArray)
    {
        Iterator colIterator;
 
        if (collectionOrArray instanceof ManageableCollection)
        {
            colIterator = ((ManageableCollection) collectionOrArray).ojbIterator();
        }
        else if (collectionOrArray instanceof Collection)
        {
            colIterator = ((Collection) collectionOrArray).iterator();
        }
        else if (collectionOrArray.getClass().isArray())
        {
            colIterator = new ArrayIterator(collectionOrArray);
        }
        else
        {
            String fieldName = cds.getClassDescriptor().getClassNameOfObject() + "." + cds.getAttributeName();
            throw new OJBRuntimeException(
                "Field '"
                    + fieldName
                    + "' "
                    + collectionOrArray.getClass()
                    + " can not be managed by OJB. Use Array, Collection or ManageableCollection instead !");
        }
        return colIterator;
    }
 
The problem occur when collectionOrArray is null. I'm trying to put a test like:
 
if(collectionOrArray==null) {
  return null;
}
 
as solution. I'll let you know if this solves.
 
Thanks,
 
Edson Richter
 
 
 
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.637 / Virus Database: 408 - Release Date: 20/3/2004

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to