You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Stefan Guggisberg (JIRA)" <ji...@apache.org> on 2006/06/16 17:57:31 UTC

[jira] Resolved: (JCR-466) Modified values of REFERENCE property not stored correctly

     [ http://issues.apache.org/jira/browse/JCR-466?page=all ]
     
Stefan Guggisberg resolved JCR-466:
-----------------------------------

    Resolution: Cannot Reproduce

i was unable to reproduce the described issue with the default configuration (derby pm).

please reopen this issue if you can reproduce it. please also provide a simple test case and
include information regarding your configuration.

here's the code i used to test:

            // assuming existing referenceable nodes at /a, /b and /c
            // assuming existing multi-valued reference property /refs with references to /a and /b

            // add reference to /c to refs property
            Value[] vals = root.getProperty("refs").getValues();
            List l = new ArrayList(Arrays.asList(vals));
            l.add(new ReferenceValue(root.getNode("c")));
            root.setProperty("refs", (Value[]) l.toArray(new Value[l.size()]));
            root.save();
            
            // ... shutdown and restart repository ...

            // verify that refs property still has 3 values refering to /a, /b *and*  /c


> Modified values of REFERENCE property not stored correctly
> ----------------------------------------------------------
>
>          Key: JCR-466
>          URL: http://issues.apache.org/jira/browse/JCR-466
>      Project: Jackrabbit
>         Type: Bug

>   Components: core
>     Reporter: David Garcia
>     Assignee: Stefan Guggisberg
>  Attachments: VersionManagerImpl_patch.diff
>
> Hi,
> In a multi-valued property of type REFERENCE, when its values are changed most of the references are lost upon save().
> I can´t attach a test case, but here is what I´ve been able to test:
>    1. REFERENCE property has values [A, B] (A and B being node UUIDs).
>    2. A new reference (to node C) is appended to the array of values. New value should be [A, B, C].
>    3. save().
>    4. Reopen session and reload.
>    5. New value is [C]. References to A and B are lost.
> I´ve checked that the PersistenceManager gets a NodeReference object with just one reference to node C, so the bug must be before the store().
> I don´t know the internals of Jackrabbit, but I´ve found a possible source of the problem in o.a.j.core.version.VersionManagerImpl#setNodeReferences().
> When it "filters out" version storage references it also wipes out previous references to A and B in the example above.
> One thing that has worked for me is to remove the not (!) in the condition:
>                 if (!hasItem(id.getParentId())) {
>                     refs.addReference(id);
>                 }
> But now even version storage references are persisted (and this shouldn´t be happening?).
> Anyway, please check whether that solution is OK.
> A patch file to change the condition is attached.
> Thanks a lot.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira