Uploaded image for project: 'Maven Doxia'
  1. Maven Doxia
  2. DOXIA-221

Fix ArrayIndexOutOfBoundsException in XhtmlBaseSink

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.1
    • 1.1
    • Module - Xdoc
    • None
    • Patch

    Description

      Attempt to render a multi column table using XDoc:

      java.lang.ArrayIndexOutOfBoundsException: 1
      	at org.apache.maven.doxia.sink.XhtmlBaseSink.tableCell(XhtmlBaseSink.java:807)
      	at org.apache.maven.doxia.sink.XhtmlBaseSink.tableCell(XhtmlBaseSink.java:780)
      	at org.apache.maven.doxia.sink.XhtmlBaseSink.tableHeaderCell(XhtmlBaseSink.java:768)
      	at org.apache.maven.doxia.parser.XhtmlBaseParser.baseStartTag(XhtmlBaseParser.java:300)
      	at org.apache.maven.doxia.module.xdoc.XdocParser.handleStartTag(XdocParser.java:213)
      	at org.apache.maven.doxia.parser.AbstractXmlParser.parseXml(AbstractXmlParser.java:103)
      	at org.apache.maven.doxia.parser.AbstractXmlParser.parse(AbstractXmlParser.java:54)
      	at org.apache.maven.doxia.module.xdoc.XdocParser.parse(XdocParser.java:93)
      	at org.apache.maven.doxia.DefaultDoxia.parse(DefaultDoxia.java:63)
      	at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.renderDocument(DefaultSiteRenderer.java:345)
      	at org.apache.maven.doxia.siterenderer.DoxiaDocumentRenderer.renderDocument(DoxiaDocumentRenderer.java:46)
      	at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.renderModule(DefaultSiteRenderer.java:272)
      	at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render(DefaultSiteRenderer.java:102)
      	at org.apache.maven.plugins.site.SiteMojo.renderLocale(SiteMojo.java:137)
      	at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:96)
      

      The XDocParser/XHtmlBaseParser calls sink.tableRows() always with a single-element array. This is usually not enough to describe all columns of the table individually. Hence, XHtmlBaseSink should be prepared to render a table cell that does not have a corresponding cellJustif entry. The patch simply repeats the justification of the last array element.

      Last but not least, it might be worth to consider changing the default cell alignment to left alignment to match the default behavior of HTML for table body cells. Additionally, left-alignment seems to be the current behavior of the xdoc module in the alpha branch.

      Attachments

        1. cell-justify.patch
          0.6 kB
          Benjamin Bentmann

        Issue Links

          Activity

            People

              ltheussl Lukas Theussl
              bentmann Benjamin Bentmann
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: