Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-11241

Content package with index definitions missing the Oak namespace causes index extraction to fail

    XMLWordPrintableJSON

Details

    Description

      If a filevault content package index definition misses the oak namespace declaration, e.g

      <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:rep="internal"
          jcr:mixinTypes="[rep:AccessControllable]"
          jcr:primaryType="nt:unstructured">
          <foo
              jcr:primaryType="oak:QueryIndexDefinition"
              propertyNames="[foo]"
              reindex="{Boolean}false"
              reindexCount="{Long}1"
              type="property">
          </foo>
      </jcr:root>
      

      parsing the XML will fail since we are synthesizing an oak:index node, which is now not resolvable to a namespace URI.

       org.apache.sling.feature.cpconverter.ConverterException: ConverterException occured on path /jcr_root/_oak_index/.content.xml with message: Failed parsing the index definitions
      	at org.apache.sling.feature.cpconverter.ContentPackage2FeatureModelConverter.onFile(ContentPackage2FeatureModelConverter.java:538)
      	at org.apache.sling.feature.cpconverter.vltpkg.BaseVaultPackageScanner.traverse(BaseVaultPackageScanner.java:112)
      [0m[91m	at org.apache.sling.feature.cpconverter.vltpkg.BaseVaultPackageScanner.traverse(BaseVaultPackageScanner.java:104)
      	at org.apache.sling.feature.cpconverter.vltpkg.BaseVaultPackageScanner.traverse(BaseVaultPackageScanner.java:104)
      	at org.apache.sling.feature.cpconverter.vltpkg.BaseVaultPackageScanner.traverse(BaseVaultPackageScanner.java:104)
      	at org.apache.sling.feature.cpconverter.vltpkg.BaseVaultPackageScanner.traverse(BaseVaultPackageScanner.java:91)
      	at org.apache.sling.feature.cpconverter.ContentPackage2FeatureModelConverter.processSubPackage(ContentPackage2FeatureModelConverter.java:404)
      	at org.apache.sling.feature.cpconverter.handlers.ContentPackageEntryHandler.processSubPackage(ContentPackageEntryHandler.java:34)
      	at org.apache.sling.feature.cpconverter.handlers.AbstractContentPackageHandler.handle(AbstractContentPackageHandler.java:95)
      	at org.apache.sling.feature.cpconverter.ContentPackage2FeatureModelConverter.process(ContentPackage2FeatureModelConverter.java:522)
      	at org.apache.sling.feature.cpconverter.ContentPackage2FeatureModelConverter.onFile(ContentPackage2FeatureModelConverter.java:536)
      	... 14 more
      [0m[91mCaused by: org.apache.sling.feature.cpconverter.ConverterException: Failed parsing the index definitions
      	at org.apache.sling.feature.cpconverter.handlers.IndexDefinitionsEntryHandler.handle(IndexDefinitionsEntryHandler.java:129)
      	at org.apache.sling.feature.cpconverter.ContentPackage2FeatureModelConverter.process(ContentPackage2FeatureModelConverter.java:522)
      	at org.apache.sling.feature.cpconverter.ContentPackage2FeatureModelConverter.onFile(ContentPackage2FeatureModelConverter.java:536)[0m[91m
      	... 24 more
      [0m[91mCaused by: org.apache.jackrabbit.vault.fs.io.DocViewParser$XmlParseException: Unknown namespace prefix used in file name 'oak:index'
      	at org.apache.jackrabbit.vault.fs.io.DocViewParser.parse(DocViewParser.java:256)
      	at org.apache.sling.feature.cpconverter.handlers.IndexDefinitionsEntryHandler.handle(IndexDefinitionsEntryHandler.java:118)
      	... 26 more
      [0m[91mCaused by: org.xml.sax.SAXException: Unknown namespace prefix used in file name 'oak:index'
      javax.jcr.NamespaceException: Unknown prefix oak[0m[91m
      [0m[91m	at org.apache.jackrabbit.vault.fs.impl.io.DocViewSAXHandler.startElement(DocViewSAXHandler.java:312)[0m[91m
      [0m[91m	at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:510)[0m[91m
      [0m[91m	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:374)[0m[91m
      [0m[91m	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:613)
      	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3063)
      	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:836)
      	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
      	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
      	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:534)
      	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888)
      	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
      	at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
      	at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1216)
      	at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:635)
      	at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:324)
      	at org.apache.jackrabbit.vault.fs.io.DocViewParser.parse(DocViewParser.java:254)
      	... 27 more
      

      Attachments

        Activity

          People

            rombert Robert Munteanu
            rombert Robert Munteanu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: