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

TOC Macro should not fail over empty attachment link

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • 12.5-rc-1
    • 12.4
    • API
    • None
    • Unit
    • Trivial
    • N/A
    • N/A

    Description

      If one has a page with the following contents:

      {{toc/}}
      
      == Rubbish [[attach:]]Link ==
      

      then the TOC macro fails with the following error message:

      java.lang.IndexOutOfBoundsException: Index: 0
      	at java.base/java.util.Collections$EmptyList.get(Collections.java:4483)
      	at org.xwiki.rendering.block.PlainTextBlockFilter.filterLinkBlock(PlainTextBlockFilter.java:103)
      	at org.xwiki.rendering.block.PlainTextBlockFilter.filter(PlainTextBlockFilter.java:84)
      	at org.xwiki.rendering.block.AbstractBlock.clone(AbstractBlock.java:520)
      	at org.xwiki.rendering.internal.macro.toc.TocBlockFilter.generateLabel(TocBlockFilter.java:54)
      	at org.xwiki.rendering.internal.macro.toc.TocTreeBuilder.createTocEntry(TocTreeBuilder.java:193)
      	at org.xwiki.rendering.internal.macro.toc.TocTreeBuilder.addItemBlock(TocTreeBuilder.java:166)
      	at org.xwiki.rendering.internal.macro.toc.TocTreeBuilder.generateTree(TocTreeBuilder.java:145)
      	at org.xwiki.rendering.internal.macro.toc.TocTreeBuilder.build(TocTreeBuilder.java:95)
      	at org.xwiki.rendering.internal.macro.toc.AbstractTocMacro.execute(AbstractTocMacro.java:122)
      	at org.xwiki.rendering.internal.macro.toc.AbstractTocMacro.execute(AbstractTocMacro.java:49)
      	at org.xwiki.rendering.internal.transformation.macro.MacroTransformation.transform(MacroTransformation.java:297)
      

      Of course the empty [[attach:]] link is totally useless, but I think it should not make the macro fail, it should just ignore it.

      Attachments

        Activity

          People

            camil7 Clemens Robbenhaar
            camil7 Clemens Robbenhaar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: