Details
-
Bug
-
Resolution: Fixed
-
Critical
-
7.0
-
N/A
-
N/A
-
Description
You can reproduce by putting the following Groovy code in a new wiki page:
{{groovy}} import org.xwiki.rendering.block.Block; import org.xwiki.rendering.block.match.MacroBlockMatcher; def xdom = xwiki.getDocument('Sandbox.WebHome').getXDOM() println xdom.getBlocks(new MacroBlockMatcher("toc"), Block.Axes.DESCENDANT) {{/groovy}}
The loop is not generated if you print the size of the returned list:
println xdom.getBlocks(new MacroBlockMatcher("toc"), Block.Axes.DESCENDANT).size()
The returned list contains a single object of type org.xwiki.rendering.block.MacroBlock as shown by:
println xdom.getBlocks(new MacroBlockMatcher("toc"), Block.Axes.DESCENDANT).get(0).getClass().getName()
Note that the infinite loop is not generated if we print a WordBlock:
{{groovy}} import org.xwiki.rendering.block.Block; import org.xwiki.rendering.block.WordBlock; import org.xwiki.rendering.block.match.ClassBlockMatcher; def xdom = xwiki.getDocument('Sandbox.WebHome').getXDOM(); println xdom.getBlocks(new ClassBlockMatcher(WordBlock.class), Block.Axes.DESCENDANT).get(0); {{/groovy}}