Uploaded image for project: 'Hippo CMS'
  1. Hippo CMS
  2. CMS-8952

Jcrdiff SAXContentHandler attributes mapping error with Xerces

    XMLWordPrintable

    Details

      Description

      Xerces only defines/provides an SAX Attributes localName when using namespace processing (in contrast to default Java JRE SAX XML parsing...).
      This causes a NullPointer exception in jcrdiff:

      java.lang.NullPointerException
      at java.util.TreeMap.compare(TreeMap.java:1188)
      at java.util.TreeMap.put(TreeMap.java:531)
      at org.onehippo.cms7.jcrdiff.content.mem.MemTreeNode.setProperty(MemTreeNode.java:151)
      at org.onehippo.cms7.jcrdiff.content.mem.MemTreeNode.setProperty(MemTreeNode.java:34)
      at org.onehippo.cms7.jcrdiff.content.xml.SaxContentHandler.endElement(SaxContentHandler.java:147)
      at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)

      This NPE is thus caused by the jcrdiff SaxContentHandler#parseAttributes method, which currently assumes the attribute localName always is defined.
      Note: the XML parsed here is also produced by jcrdiff itself, which does NOT use any qualified/namespaced attributes...

      To fix this, the #parseAttributes method can/must instead use the Attributes#getQName method, which is safe and should provide the same attribute name value in this context (because no qualified/namespaced attributes are generated by jcrdiff in the first place).

        Attachments

          Activity

            People

            Assignee:
            adouma Ate Douma
            Reporter:
            adouma Ate Douma
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: