Steps to reproduce:
- Add the following or similar content to a page
{{tip}}
Hello
{{/tip}}
----
{{info}}
{{task createDate="2023/07/02 09:43" reporter="XWiki.superadmin" reference="TEOS.TeoSpace Home.Task_0"}}
ffasadas
{{/task}}
{{/info}}
- Save and view the page
Expected results:
The added task will have an id and reference assigned and therefore will display a link to the created page.
Actual results:
The task doesn't have a reference or id.
This happens because the listener that assigns the reference will search for tasks recursively inside the content of all the macros that support XWiki syntax. When detecting a new task, it will add some new parameters and possibly a new content. To change the content, we need to replace the task with a clone of it. This will change the content of it's parent. We take the list of children of the parent, we delete our task using it's index and replace it with the clone. The problem is with finding the index. Using the list.indexOf() function will throw an exception. At some point in time, it will call the AbstractMacroBlock.equals(otherMacro) function that will cast the otherMacro to AbstractMacroBlock. In our specific example, the dashed line ---- is a HorizontalLineBlock which is not an instance of AbstractMacroBlock.
Steps to reproduce:
Expected results:
The added task will have an id and reference assigned and therefore will display a link to the created page.
Actual results:
The task doesn't have a reference or id.
This happens because the listener that assigns the reference will search for tasks recursively inside the content of all the macros that support XWiki syntax. When detecting a new task, it will add some new parameters and possibly a new content. To change the content, we need to replace the task with a clone of it. This will change the content of it's parent. We take the list of children of the parent, we delete our task using it's index and replace it with the clone. The problem is with finding the index. Using the
list.indexOf()function will throw an exception. At some point in time, it will call theAbstractMacroBlock.equals(otherMacro)function that will cast theotherMacrotoAbstractMacroBlock. In our specific example, the dashed line----is aHorizontalLineBlockwhich is not an instance ofAbstractMacroBlock.