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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 7.4
    • Fix Version/s: 8.1-milestone-1
    • Component/s: Old Core
    • Labels:
      None
    • Difficulty:
      Unknown
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Similar issues:

      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: