Uploaded image for project: 'Hippo Repository'
  1. Hippo Repository
  2. REPO-1732

Jackrabbit caches PropertyDefinition too eagerly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: jackrabbit-2.14.0-h2
    • Labels:
      None
    • Similar issues:
    • Processed by team:
      Turing
    • Sprint:
      Turing Sprint 160

      Description

      The following scenario currently has a problem:

      1) Add a new single valued property (say 'foo') to a jcr node that can contain residual single valued properties and residual multi-valued properties
      2) Safe step (1) with session 1
      3) Read in the property with session 2 and assert:

      assertFalse(session2.getNode("...").getProperty("foo").isMultiple());
      assertFalse(session2.getNode("...").getProperty("foo").getDefinition().isMultiple());
      

      4) With session 1, remove property 'foo'
      5) with session 1, add property 'foo' as multiple String
      6) save session 1
      7) Read in the property with session 1 and assert:

      assertTrue(session1.getNode("...").getProperty("foo").isMultiple());
      assertTrue(session1.getNode("...").getProperty("foo").getDefinition().isMultiple());
      

      The above works.
      8) Read in the property with session 2 and assert:

      assertTrue(session2.getNode("...").getProperty("foo").isMultiple());
      assertTrue(session2.getNode("...").getProperty("foo").getDefinition().isMultiple());
      

      Above, the second assert fails.

      Note that refreshing the session does not fix it. It stays broken. A delay (say thread sleep 100 ms) doesn't help either! A new session (session 3) does pass the assertions. It is really only session 2 that has a broken property definition

      The above fails because the PropertyImpl in JR contains

          public PropertyDefinition getDefinition() throws RepositoryException {
              // check state of this instance
              sanityCheck();
      
              return data.getPropertyDefinition();
          }
      

      and 'data' is the same ItemDate object. The code in there is:

          public ItemDefinition getDefinition() throws RepositoryException {
              if (definition == null && itemMgr != null) {
                  if (isNode()) {
                      definition = itemMgr.getDefinition((NodeState) state);
                  } else {
                      definition = itemMgr.getDefinition((PropertyState) state);
                  }
              }
              return definition;
          }
      

      the instance variable 'definition' is never reloaded once it has been loaded for some session which cause the problem

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                aschrijvers Ard Schrijvers
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: