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

Nested lists with paragraphs are incorrectly rendered and cause NPEs

    XMLWordPrintable

Details

    • Unit
    • Unknown
    • N/A
    • N/A

    Description

      The following code:

       

      <ol>
        <li><p>Hello</p></li>
        <li><p>world</p>
          <ol>
            <li><p>Hello nested</p></li>
            <li><p>world nested</p></li>
          </ol>
        </li>
      </ol> 

      Is rendered as follows in HTML 4.01 and HTML 5 syntaxes in XWiki 16.2:

       

      And as follows in XWiki 16.1, and probably 14.10.X and 15.X:

      And as follows in all versions with XHTML 1.0 and XHTML 5 syntaxes:

      Here's the exception in XWiki 16.2:

       

      2024-04-09 10:58:19,932 [qtp798244209-715 - http://localhost:8080/xwiki/bin/preview/HTMLPage/WebHome] WARN  c.x.x.w.XWikiAction            - Uncaught exception: Error number 0 in 4: Failed to convert document to syntax [xhtml/1.0] 
      com.xpn.xwiki.XWikiException: Error number 0 in 4: Failed to convert document to syntax [xhtml/1.0]
              at com.xpn.xwiki.doc.XWikiDocument.convertSyntax(XWikiDocument.java:8864)
              at com.xpn.xwiki.web.SaveAction.convertSyntax(SaveAction.java:605)
              at com.xpn.xwiki.web.SaveAction.save(SaveAction.java:219)
              at com.xpn.xwiki.web.SaveAction.action(SaveAction.java:521)
              at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:636)
              at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:339)
              at com.xpn.xwiki.web.LegacyActionServlet.service(LegacyActionServlet.java:108)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
              at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1419)
              at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
              at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1665)
              at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:122)
              at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
              at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
              at org.xwiki.wysiwyg.filter.ConversionFilter.doFilter(ConversionFilter.java:61)
              at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
              at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
              at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:132)
              at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
              at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
              at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208)
              at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
              at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
              at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:117)
              at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
              at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
              at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527)
              at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)
              at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:616)
              at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
              at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223)
              at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1580)
              at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
              at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1384)
              at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
              at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
              at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1553)
              at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
              at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1306)
              at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
              at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:215)
              at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:135)
              at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:112)
              at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
              at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
              at org.xwiki.wysiwyg.filter.ConversionFilter.doFilter(ConversionFilter.java:61)
              at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
              at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
              at org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63)
              at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
              at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
              at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:132)
              at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
              at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
              at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208)
              at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
              at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
              at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:117)
              at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:210)
              at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
              at org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:170)
              at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
              at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
              at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527)
              at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)
              at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:598)
              at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
              at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223)
              at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1580)
              at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
              at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1384)
              at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
              at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
              at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1553)
              at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
              at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1306)
              at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
              at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:192)
              at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:51)
              at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
              at org.eclipse.jetty.server.Server.handle(Server.java:563)
              at org.eclipse.jetty.server.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1598)
              at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:753)
              at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:501)
              at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:287)
              at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
              at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
              at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
              at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:421)
              at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:390)
              at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:277)
              at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:199)
              at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
              at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
              at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
              at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
              at java.base/java.lang.Thread.run(Thread.java:840)
      Caused by: com.xpn.xwiki.XWikiException: Error number 0 in 4: Failed to convert document to syntax [XHTML 1.0]
              at com.xpn.xwiki.doc.XWikiDocument.performSyntaxConversion(XWikiDocument.java:9012)
              at com.xpn.xwiki.doc.XWikiDocument.convertSyntax(XWikiDocument.java:8878)
              at com.xpn.xwiki.doc.XWikiDocument.convertSyntax(XWikiDocument.java:8862)
              ... 96 common frames omitted
      Caused by: com.xpn.xwiki.XWikiException: Error number 0 in 4: Failed to parse content of syntax [xhtml/5]
              at com.xpn.xwiki.doc.XWikiDocument.parseContent(XWikiDocument.java:9057)
              at com.xpn.xwiki.doc.XWikiDocument.performSyntaxConversion(XWikiDocument.java:9009)
              ... 98 common frames omitted
      Caused by: org.xwiki.rendering.parser.ParseException: Failed to parse with syntax [xhtml/5].
              at org.xwiki.rendering.internal.parser.DefaultContentParser.parse(DefaultContentParser.java:69)
              at org.xwiki.rendering.internal.parser.DefaultContentParser.parse(DefaultContentParser.java:77)
              at com.xpn.xwiki.doc.XWikiDocument.parseContent(XWikiDocument.java:9051)
              ... 99 common frames omitted
      Caused by: org.xwiki.rendering.parser.ParseException: Failed to parse input source
              at org.xwiki.rendering.internal.parser.wikimodel.AbstractWikiModelParser.parse(AbstractWikiModelParser.java:147)
              at org.xwiki.rendering.internal.parser.xhtml.XHTMLParser.parse(XHTMLParser.java:219)
              at org.xwiki.rendering.internal.parser.wikimodel.AbstractWikiModelParser.parse(AbstractWikiModelParser.java:108)
              at org.xwiki.rendering.internal.parser.xhtml.XHTMLParser.parse(XHTMLParser.java:199)
              at org.xwiki.rendering.internal.parser.wikimodel.AbstractWikiModelParser.parse(AbstractWikiModelParser.java:101)
              at org.xwiki.rendering.internal.parser.xhtml.XHTMLParser.parse(XHTMLParser.java:188)
              at org.xwiki.rendering.internal.parser.DefaultContentParser.parse(DefaultContentParser.java:64)
              ... 101 common frames omitted
      Caused by: org.xwiki.rendering.wikimodel.WikiParserException: java.lang.NullPointerException: Cannot read field "fName" because "this.fParent.fParent" is null
              at org.xwiki.rendering.wikimodel.xhtml.XhtmlParser.parse(XhtmlParser.java:136)
              at org.xwiki.rendering.internal.parser.wikimodel.AbstractWikiModelParser.parse(AbstractWikiModelParser.java:141)
              ... 107 common frames omitted
      Caused by: java.lang.NullPointerException: Cannot read field "fName" because "this.fParent.fParent" is null
              at org.xwiki.rendering.wikimodel.xhtml.impl.TagContext.getParent(TagContext.java:111)
              at org.xwiki.rendering.wikimodel.xhtml.handler.ListTagHandler.isBlockHandler(ListTagHandler.java:38)
              at org.xwiki.rendering.wikimodel.xhtml.handler.TagHandler.beginElement(TagHandler.java:54)
              at org.xwiki.rendering.wikimodel.xhtml.impl.TagContext.beginElement(TagContext.java:74)
              at org.xwiki.rendering.wikimodel.xhtml.impl.TagStack.beginElement(TagStack.java:114)
              at org.xwiki.rendering.wikimodel.xhtml.impl.XhtmlHandler.startElement(XhtmlHandler.java:222)
              at java.xml/org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:539)
              at org.xwiki.rendering.wikimodel.xhtml.filter.XHTMLWhitespaceXMLFilter.startElement(XHTMLWhitespaceXMLFilter.java:156)
              at java.xml/org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:539)
              at org.xwiki.rendering.wikimodel.xhtml.filter.AccumulationXMLFilter.startElement(AccumulationXMLFilter.java:74)
              at java.xml/org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:539)
              at org.xwiki.rendering.wikimodel.xhtml.filter.DTDXMLFilter.startElement(DTDXMLFilter.java:73)
              at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
              at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
              at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
              at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
              at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
              at org.apache.xerces.parsers.XML11NonValidatingConfiguration.parse(Unknown Source)
              at org.apache.xerces.parsers.XML11NonValidatingConfiguration.parse(Unknown Source)
              at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
              at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
              at java.xml/org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:345)
              at org.xwiki.rendering.wikimodel.xhtml.filter.DefaultXMLFilter.parse(DefaultXMLFilter.java:58)
              at java.xml/org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:345)
              at org.xwiki.rendering.wikimodel.xhtml.filter.DefaultXMLFilter.parse(DefaultXMLFilter.java:58)
              at java.xml/org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:345)
              at org.xwiki.rendering.wikimodel.xhtml.filter.DefaultXMLFilter.parse(DefaultXMLFilter.java:58)
              at org.xwiki.rendering.wikimodel.xhtml.XhtmlParser.parse(XhtmlParser.java:134)
              ... 108 common frames omitted 

      It should be rendered as:

      1. Hello
      2. world
        1. Hello nested
        2. world nested

      See also:

      • XRENDERING-619 (Lists with nested paragraphs are incorrectly converted to XWiki syntax)
      • CONFLUENCE-230 (Nested lists with paragraphs are incorrectly rendered)

      Attachments

        Issue Links

          Activity

            People

              MichaelHamann Michael Hamann
              rjakse Raphaël Jakse
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: