Uploaded image for project: 'XWiki Rendering'
  1. XWiki Rendering
  2. XRENDERING-440

XHTML Parser shouldn't fail when content is empty

    XMLWordPrintable

Details

    • Unit
    • N/A
    • N/A

    Description

      Right now XWIKI-8250 hid the issue under the carpet by having a special "if" in getXDOM() but this is not the best way:

      if (StringUtils.isEmpty(getContent())) {
          LOGGER.debug("Syntax [{}] cannot handle empty input. Returning empty XDOM.", getSyntax());
          return new XDOM(Collections.<Block>emptyList());
      }
      

      So when you have XHTML 1.0 as the default syntax, it seems to work when creating a new page but you have a huge stack trace in the console because everytime the title is rendered it calls XWikiDocument.getDefaultEditMode() which in turn calls getXDOM() which tries to parse the content to find include macros. Reason: "for all document included check if one of them has an EditModeClass object attached to it, or a SheetClass object (deprecated since 3.1M2) attached to it. If so then the edit mode is inline.".

      It's better to add support for empty content in the XHTML parser and remove this "if" in getXDOM().

      Attachments

        Issue Links

          Activity

            People

              vmassol Vincent Massol
              vmassol Vincent Massol
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: