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

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

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
 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


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

Posted by "Tobias Bocanegra (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-466?page=all ]
     
Tobias Bocanegra closed JCR-466:
--------------------------------

    Resolution: Invalid

unable to reproduce this issue. please provide a valid test case.

> 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: Tobias Bocanegra
>  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


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

Posted by "David Garcia (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-466?page=all ]

David Garcia updated JCR-466:
-----------------------------

    Attachment: VersionManagerImpl_patch.diff

> 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
>  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


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

Posted by "Tobias Bocanegra (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-466?page=all ]
     
Tobias Bocanegra reopened JCR-466:
----------------------------------


reading david's comment, this probably only happens when referring to items in the version storage.

btw: the patch does not fix this problem

> 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


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

Posted by "Tobias Bocanegra (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-466?page=all ]

Tobias Bocanegra reassigned JCR-466:
------------------------------------

    Assign To: Tobias Bocanegra  (was: Stefan Guggisberg)

> 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: Tobias Bocanegra
>  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


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

Posted by "Stefan Guggisberg (JIRA)" <ji...@apache.org>.
     [ 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


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

Posted by "David Garcia (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JCR-466?page=comments#action_12416900 ] 

David Garcia commented on JCR-466:
----------------------------------

Hi,

I´ve been doing some testing and debugging and here´s what I can tell you so far:
- "Real" deployment environment is Model 2 (Shared) with a custom FileSystem and PersistenceManager.
- "Test" deployment environment is a standalone command line application with LocalFileSystem and XMLPersistenceManager.
- The bug has only been reproduced in "Real". In "Test" everything works fine.
- I´m positive the bug has nothing to do with using a custom FileSystem and PersistenceManager.
- Both the "nt:resource" node and the referring node have "mix:versionable" mixin type.

When I create the "nt:resource" node, add a reference to it and call save(), the PersistenceManager´s store() method is called three times:
1. Store the "nt:resource" node.
2. Store the modified reference property.
3. Store de modified references.
Between steps 2 and 3, "virtual node references" are filtered out at line 542 in SharedItemStateManager.
And here´s the difference between both environments. In "Real", virtualProviders[i].hasItemState(id) is true and virtual = true. In "Test", virtualProviders[i].hasItemState(id) is false.
Does this help?

If you need anything else, feel free to ask :-)
Thanks.

> 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: Tobias Bocanegra
>  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


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

Posted by "Stefan Guggisberg (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-466?page=all ]

Stefan Guggisberg reassigned JCR-466:
-------------------------------------

    Assign To: Stefan Guggisberg

> 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