Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-2653

MagnoliaV2Filter emits bogus and unbalanced sv:value element - may cause StackOverflow on large imports

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 4.0.2, 4.1.1
    • 3.6.3
    • core
    • None
    • JDK1.6, WIn2000 and Suse Linux
    • Yes
    • Yes

      MagnoliaV2Filter (user also when importing repository) data emits bogus sv:value and unbalanced sv:value tag. When importing large repositories (3GB with thousands of Documents) this may cause stack overflow due extreme element nesting:

      Caused by: java.lang.StackOverflowError
      at java.util.HashMap.get(HashMap.java:300)
      at org.apache.jackrabbit.core.xml.NamespaceContext.getURI(NamespaceContext.java:93)
      at org.apache.jackrabbit.core.xml.NamespaceContext.getURI(NamespaceContext.java:97)
      at org.apache.jackrabbit.core.xml.NamespaceContext.getURI(NamespaceContext.java:97)
      at org.apache.jackrabbit.core.xml.NamespaceContext.getURI(NamespaceContext.java:97)
      at org.apache.jackrabbit.core.xml.NamespaceContext.getURI(NamespaceContext.java:97)
      at org.apache.jackrabbit.core.xml.NamespaceContext.getURI(NamespaceContext.java:97)
      at org.apache.jackrabbit.core.xml.NamespaceContext.getURI(NamespaceContext.java:97)
      ...
      (thousands of lines)

      It turned out, that this overflow is caused by MagnoliaV2Filter when replacing jcr:primary of MetataData type.

      Here is excerpt from input data:

      <sv:node sv:name="MetaData">
      <sv:property sv:name="jcr:primaryType" sv:type="Name">
      <sv:value>mgnl:metaData</sv:value>
      </sv:property>
      <sv:property sv:name="jcr:created" sv:type="Date">
      <sv:value>2009-03-09T12:20:25.822+01:00</sv:value>
      </sv:property>

      Which is by this filter transormed into:

      <sv:node sv:name="MetaData">
      <sv:property sv:name="jcr:primaryType" sv:type="Name">
      <sv:value>mgnl:metaData</sv:value>
      </sv:property>

      <sv:value>mgnl:metaData

      <sv:property sv:name="jcr:created"
      sv:type="Date">
      <sv:value>2009-03-09T12:20:25.822+01:00</sv:value>
      </sv:property>

      There is a clear difference - an spurious (and unclosed) <sv:value>mgnl:metaData element

      I'm supposed that its startElement() method is missing somehting like

      if (skipProperty && qName.equals("sv:value") )

      { skipValue = true; return; }

      I shall try and send possible fix hopefully in few days.

        Acceptance criteria

          1. dms.Test.xml
            2 kB
          2. M2FilterMetaBugTest.java
            2 kB
          3. MAGNOLIA-2653.patch
            10 kB
          4. MagnoliaV2FilterSvValueFix.diff
            3 kB
          5. MagnoliaV2FilterTestCase.diff
            6 kB
          6. v2filter-out-14551.xml
            2 kB

              fgiust Fabrizio Giustina
              henryk.paluch Henryk Paluch
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD