Jackrabbit Content Repository
  1. Jackrabbit Content Repository
  2. JCR-2740

On missing child node, automatically remove the entry (when a session attribute is set)

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2
    • Component/s: jackrabbit-core
    • Labels:
      None

      Description

      If a node points to a non-existing child node (which is a repository inconsistency), currently this child node is silently ignored for read operations (as far as I can tell). However, when trying to add another child node with the same name, an exception is thrown with a message saying a child node with this name already exists. Also, the parent node can't be removed.

      One solution is to remove the bad child node entry, but only if the session attribute "org.apache.jackrabbit.autoFixCorruptions" is set (so by default the repository is not changed 'secretly'):

      SimpleCredentials cred = new SimpleCredentials(...);
      cred.setAttribute("org.apache.jackrabbit.autoFixCorruptions", "true");
      rep.login(cred);

      It's not a perfect solution, but it might be better than throwing an exception and basically preventing changes.

      Another solution (not implemented) would be to rename the missing child node entry when trying to add a child node with the same name (for example add the current date/time, or a random digit until there is no conflict), and then continue with adding the new child node.

      1. jcr-2740.patch
        7 kB
        Thomas Mueller
      2. jcr-2740-b.patch
        7 kB
        Thomas Mueller
      3. jcr-2740-c.patch
        17 kB
        Thomas Mueller
      4. JCR-2740-d.patch
        18 kB
        Stefan Guggisberg

        Activity

        Jukka Zitting made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Thomas Mueller made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Thomas Mueller made changes -
        Summary On missing child node, automatically remove the entry On missing child node, automatically remove the entry (when a session attribute is set)
        Fix Version/s 2.2.0 [ 12314844 ]
        Description If a node points to a non-existing child node (which is a repository inconsistency), currently this child node is silently ignored for read operations (as far as I can tell). However, when trying to add another child node with the same name, an exception is thrown with a message saying a child node with this name already exists. Also, the parent node can't be removed.

        One solution is to remove the bad child node entry, but only if a session attribute is set (so by default the repository is not changed 'secretly').

        It's not a perfect solution, but it might be better than throwing an exception and basically preventing changes.

        Another solution (not implemented) would be to rename the missing child node entry when trying to add a child node with the same name (for example add the current date/time, or a random digit until there is no conflict), and then continue with adding the new child node.

        If a node points to a non-existing child node (which is a repository inconsistency), currently this child node is silently ignored for read operations (as far as I can tell). However, when trying to add another child node with the same name, an exception is thrown with a message saying a child node with this name already exists. Also, the parent node can't be removed.

        One solution is to remove the bad child node entry, but only if the session attribute "org.apache.jackrabbit.autoFixCorruptions" is set (so by default the repository is not changed 'secretly'):

            SimpleCredentials cred = new SimpleCredentials(...);
            cred.setAttribute("org.apache.jackrabbit.autoFixCorruptions", "true");
            rep.login(cred);

        It's not a perfect solution, but it might be better than throwing an exception and basically preventing changes.

        Another solution (not implemented) would be to rename the missing child node entry when trying to add a child node with the same name (for example add the current date/time, or a random digit until there is no conflict), and then continue with adding the new child node.

        Thomas Mueller made changes -
        Summary On missing child node, automatically rename entry when trying to add a node with the same name On missing child node, automatically remove the entry
        Description If a node points to a non-existing child node (which is a repository inconsistency), currently this child node is silently ignored for read operations (as far as I can tell). However, when trying to add another child node with the same name, an exception is thrown with a message saying a child node with this name already exists.

        I suggest to rename the missing child node entry in that case (for example add the current date/time, or a random digit until there is no conflict), and then continue with adding the new child node. I wouldn't automatically remove the bad entry, because the node might "appear" later (after a restore), and because removing data from the repository seems wrong.

        It's not a perfect solution, but it might be better than throwing an exception and basically preventing changes.
        If a node points to a non-existing child node (which is a repository inconsistency), currently this child node is silently ignored for read operations (as far as I can tell). However, when trying to add another child node with the same name, an exception is thrown with a message saying a child node with this name already exists. Also, the parent node can't be removed.

        One solution is to remove the bad child node entry, but only if a session attribute is set (so by default the repository is not changed 'secretly').

        It's not a perfect solution, but it might be better than throwing an exception and basically preventing changes.

        Another solution (not implemented) would be to rename the missing child node entry when trying to add a child node with the same name (for example add the current date/time, or a random digit until there is no conflict), and then continue with adding the new child node.

        Stefan Guggisberg made changes -
        Attachment JCR-2740-d.patch [ 12460505 ]
        Thomas Mueller made changes -
        Attachment jcr-2740-c.patch [ 12460453 ]
        Thomas Mueller made changes -
        Attachment jcr-2740-b.patch [ 12460379 ]
        Thomas Mueller made changes -
        Attachment jcr-2740.patch [ 12459058 ]
        Thomas Mueller made changes -
        Field Original Value New Value
        Assignee Thomas Mueller [ tmueller ]
        Thomas Mueller created issue -

          People

          • Assignee:
            Thomas Mueller
            Reporter:
            Thomas Mueller
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development