On Jan 17, 2008 2:16 PM, sgomez <[EMAIL PROTECTED]> wrote:

>
> Hello again.
>
> Using XmlBeans I've been able to change my array to a
> MyCustomList<MyClass>,
> with MyCustomList extending java.util.AbstractList<MyClass>. I thought
> this
> way it would be easily converted to a ManageableArrayList, but I still get
> the same JcrMappingException in
> ManageableCollectionUtil.getManageableCollection method. This is the stack
> trace:
>
> org.apache.jackrabbit.ocm.exception.JcrMappingException: Unsupported
> collection
> type : *********** (MyCustomList class)
>        at
> org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableColle
> ctionUtil.getManageableCollection(ManageableCollectionUtil.java:153)
>        at
> org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverte
> rImpl.insertCollectionFields(ObjectConverterImpl.java:780)
>        at
> org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverte
> rImpl.insert(ObjectConverterImpl.java:221)
>        at
> org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverte
> rImpl.insert(ObjectConverterImpl.java:146)
>        at
> org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl.inser
> t(ObjectContentManagerImpl.java:407)
> Having a look at that method, it seems to not realize my list is a List.
> Is
> it possible that the "if (object.getClass().equals(XXX.class)" clauses
> should be "if (object instanceof XXX)" ?  (I have already reassured myself
> that MyList instance of List returns true).
>

It looks like a big bug. I'm going to review the code and add a new unit
test which match to your case. If you want, you can add new jira issue.


> Another thing I've seen a bit strange is the call to that method from
> ObjectConverterImpl.java:
>
> ManageableCollection manageableCollection =
> ManageableCollectionUtil.getManageableCollection(collection);


ManageableCollection is a common interface for Collection & Map. So, the
object field is converted into a ManageableCollection before calling the
desired CollectionConverter.
By this the DefaultCollectionConverter and other converters are able to
manage both structure.
"collection" is certainly a very bad name.


br,
Christophe

Reply via email to