Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-13280

NPE when rendering a page when a parser fails to parse some content

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 8.1-milestone-1
    • 7.4
    • Old Core
    • None
    • Unknown
    • N/A
    • N/A

    Description

      The issue is in XWikiDocument.getXDOM() which does this:

          @Override
          public XDOM getXDOM()
          {
              if (this.xdomCache == null) {
                  try {
                      this.xdomCache = parseContent(getContent());
                  } catch (XWikiException e) {
                      if (StringUtils.isEmpty(getContent())) {
                          LOGGER.debug("Syntax [{}] cannot handle empty input. Returning empty XDOM.", getSyntax());
                          return new XDOM(Collections.<Block>emptyList());
                      }
                      LOGGER.error("Failed to parse document content to XDOM", e);
                  }
              }
      
              return this.xdomCache.clone();
          }
      

      So if there's an error generated by the parser this.xdomCache is null and this.xdomCache.clone() fails with a NPE.

      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: