[
https://issues.apache.org/jira/browse/JCR-1470?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Christophe Lombart reassigned JCR-1470:
---------------------------------------
Assignee: Christophe Lombart
> NPE in BeanReferenceCollectionConverterImpl on update on empty collection
> -------------------------------------------------------------------------
>
> Key: JCR-1470
> URL: https://issues.apache.org/jira/browse/JCR-1470
> Project: Jackrabbit
> Issue Type: Bug
> Components: jackrabbit-ocm
> Affects Versions: 1.5
> Environment: mac os leopard, java5
> Reporter: Stephane Landelle
> Assignee: Christophe Lombart
>
> use case :
> in the same transaction :
> *) retrieve an object that has a collection of references, yet empty
> *) add an element in the collection
> *) update the object
> consequence :
> org.apache.jackrabbit.ocm.exception.ObjectContentManagerException: Cannot
> insert collection field : authors of class com.weka.content.api.model.Folder;
> nested exception is java.lang.NullPointerException: null
> java.lang.NullPointerException
> at
> org.apache.jackrabbit.ocm.manager.collectionconverter.impl.ManageableArrayList$$EnhancerByCGLIB$$8f15dde4.getSize(<generated>)
> at
> org.apache.jackrabbit.ocm.manager.collectionconverter.impl.BeanReferenceCollectionConverterImpl.addUuidProperties(BeanReferenceCollectionConverterImpl.java:154)
> at
> org.apache.jackrabbit.ocm.manager.collectionconverter.impl.BeanReferenceCollectionConverterImpl.doUpdateCollection(BeanReferenceCollectionConverterImpl.java:101)
> The failing line is in addUuidProperties :
> Value[] values = new Value[collection.getSize()];
> It seems the CGlib enhanced collection fails and needs to be initialized
> before.
> For example, in doUpdateCollection, if I code :
> // Delete existing values
> if (parentNode.hasProperty(jcrName)) {
> parentNode.setProperty(jcrName, (Value[]) null);
> }
>
> if (collection != null) {
> collection.getSize(); <<<<<<
> }
> I get a NPE on collection.getSize();
> but if I code :
> if (collection != null) {
> collection.getSize();
> }
> // Delete existing values
> if (parentNode.hasProperty(jcrName)) {
> parentNode.setProperty(jcrName, (Value[]) null);
> }
> everything runs fine?!
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.