Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-1878

Same name siblings are incorrectly prevented in some cases

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Blocker
    • 3.2.0.Final
    • 3.1.3.Final
    • JCR
    • None

    Description

      Given the following CND file:

      <jcr='http://www.jcp.org/jcr/1.0'>
      <nt='http://www.jcp.org/jcr/nt/1.0'>
      <inf='http://www.example.com/test'>
      
      [inf:patient] > mix:versionable, nt:hierarchyNode
      + * (inf:patientId) COPY
      + * (inf:section) SNS COPY 
      - inf:masterId (STRING) mandatory COPY
      - inf:masterNs (STRING) mandatory COPY
      
      
      /**
       * A section node is a named container of either episodes or documents.
       */
      [inf:section] > nt:hierarchyNode orderable 
      - inf:name (STRING) mandatory COPY
      + * (nt:hierarchyNode) SNS VERSION 
      
      [inf:patientId]
      - inf:name (STRING) mandatory COPY
      

      the following algorithm should be allowed, but ModeShape incorrectly throws an exception:

      1. create an inf:patient node (with any mandatory properties)
      2. create one or more inf:section nodes (with any mandatory properties)
      3. save
      4. create another inf:section node (with any mandatory properties)

      The last step causes the following exception:

      javax.jcr.ItemExistsException: A node definition that allows same name siblings could not be found for the node "{}section" in workspace "default"
      	at org.modeshape.jcr.JcrSession$JcrPreSave.processAfterLocking(JcrSession.java:1914)
      	at org.modeshape.jcr.cache.document.WritableSessionCache.runPreSaveAfterLocking(WritableSessionCache.java:479)
      	at org.modeshape.jcr.cache.document.WritableSessionCache.save(WritableSessionCache.java:540)
      	at org.modeshape.jcr.JcrSession.save(JcrSession.java:986)
      	at ...
      

      Note that the "inf:patient" node definition must have two residual child node definitions (one of type "inf:patientId" and the other of "inf:section") in order for this test to fail. If the "inf:patientId" child node definition is removed, then it works fine.

      Attachments

        Activity

          People

            rhauch Randall Hauch (Inactive)
            rhauch Randall Hauch (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: