There is 1 update.
 
 
XWiki Rendering / cid:jira-generated-image-avatar-589fb6bf-ba4a-4bd7-ac3c-2c98310994c3 XRENDERING-753 Open

User can not save page after copy and paste the row with mentioned macro and some text into another row in the table

 
View issue   ยท   Add comment
 

1 update

 
cid:jira-generated-image-avatar-670f7036-15e0-440c-b187-fbd584c9a32b Changes by Vincent Massol on 05/Aug/24 15:23
 
Description: h3. Prerequisites:
* XWiki 15.10.11 or XWiki 16.6.0
* created an empty table size 3 columns and 2 rows on Sandbox space

h3. Steps to reproduce:
# Trigger in-place editing via CKeditor
# Fill the first row of the table by adding the
mentioned mention macro for and mention the current user (XWiki Admin) into 2 cell 2 and some text into 3 cell 3
# Select entire 1st row and copy it into clipboard
# Paste the copied row into 2nd row
# Try to save the page

h3. Actual result

You won't be able to save the page due to an error that will be displayed in the pop-up "Failed to save the page. Reason: Server not responding".

h3. Expected result

The user has saved the page without errors.

h3. Notes

The entire trace of error in catalina logs will have these

{code:none}
2024-08-02 10:28:08,823 [http-nio-7635-exec-8 - http://localhost:7635/xwiki/bin/save/Sandbox/Table%20With%20Mentioning/] ERROR faultRequestParameterConverter - Exception while parsing HTML
java.lang.RuntimeException: Exception while parsing HTML
        at org.xwiki.wysiwyg.internal.converter.DefaultHTMLConverter.fromHTML(DefaultHTMLConverter.java:150)
        at org.xwiki.wysiwyg.internal.converter.DefaultRequestParameterConverter.convertHTML(DefaultRequestParameterConverter.java:128)
        at org.xwiki.wysiwyg.internal.converter.DefaultRequestParameterConverter.convert(DefaultRequestParameterConverter.java:111)
        at org.xwiki.wysiwyg.internal.converter.DefaultRequestParameterConverter.convert(DefaultRequestParameterConverter.java:90)
        at org.xwiki.wysiwyg.filter.ConversionFilter.doFilter(ConversionFilter.java:58)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
        at org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
        at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:132)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
        at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
        at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:117)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:168)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:130)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:670)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:390)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:928)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1794)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
        at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
        at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.base/java.lang.Thread.run(Thread.java:1583)
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:121)
        at org.xwiki.rendering.internal.parser.xhtml.XHTMLParser.parse(XHTMLParser.java:210)
        at org.xwiki.wysiwyg.internal.converter.DefaultHTMLConverter.fromHTML(DefaultHTMLConverter.java:145)
        ... 38 common frames omitted
Caused by: org.xwiki.rendering.wikimodel.WikiParserException: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
        at org.xwiki.rendering.wikimodel.xhtml.XhtmlParser.parse(XhtmlParser.java:136)
        at org.xwiki.rendering.internal.parser.wikimodel.AbstractWikiModelParser.parse(AbstractWikiModelParser.java:141)
        ... 42 common frames omitted
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
        at org.xwiki.rendering.internal.parser.xhtml.wikimodel.XHTMLMarkerResourceReferenceParser.parse(XHTMLMarkerResourceReferenceParser.java:55)
        at org.xwiki.rendering.internal.parser.xhtml.wikimodel.XWikiCommentHandler.handleLinkCommentStop(XWikiCommentHandler.java:246)
        at org.xwiki.rendering.internal.parser.xhtml.wikimodel.XWikiCommentHandler.onComment(XWikiCommentHandler.java:99)
        at org.xwiki.rendering.wikimodel.xhtml.impl.TagStack.onComment(TagStack.java:289)
        at org.xwiki.rendering.wikimodel.xhtml.impl.XhtmlHandler.comment(XhtmlHandler.java:232)
        at org.xwiki.rendering.wikimodel.xhtml.filter.DefaultXMLFilter.comment(DefaultXMLFilter.java:87)
        at org.xwiki.rendering.wikimodel.xhtml.filter.XHTMLWhitespaceXMLFilter.comment(XHTMLWhitespaceXMLFilter.java:255)
        at org.xwiki.rendering.wikimodel.xhtml.filter.DefaultXMLFilter.comment(DefaultXMLFilter.java:87)
        at org.xwiki.rendering.wikimodel.xhtml.filter.AccumulationXMLFilter.comment(AccumulationXMLFilter.java:94)
        at org.xwiki.rendering.wikimodel.xhtml.filter.DefaultXMLFilter.comment(DefaultXMLFilter.java:87)
        at org.xwiki.rendering.wikimodel.xhtml.filter.DTDXMLFilter.comment(DTDXMLFilter.java:95)
        at org.apache.xerces.parsers.AbstractSAXParser.comment(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanComment(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)
        ... 43 common frames omitted
{code}

The request of the save {code}http://localhost:7635/xwiki/bin/save/Sandbox/Table%20With%20Mentioning/{code} will return 400 status error. The
bode for this request source view will hold contain the HTML following wrong content:

{code:none}
<table><tbody><tr><td>&nbsp;</td><td><!--startmacro:mention|-|reference="XWiki.npetrenko"+style="FULL_NAME"+anchor="XWiki-npetrenko-vmfpml"--><!--stopmacro--></td><td>Here+is+some+Text</td></tr><tr><td>&nbsp;</td><td><span+tabindex="-1"+contenteditable="false"><span+data-macro="startmacro:mention|-|reference=&quot;XWiki.npetrenko&quot;+style=&quot;FULL_NAME&quot;+anchor=&quot;XWiki-npetrenko-vmfpml&quot;"+data-widget="xwiki-macro"+data-xwiki-dom-updated="true"+class="macro"><span+class="hidden+macro-placeholder">macro:mention</span><span+data-macro="startmacro:velocity|-||-|#set+($reference+=+$wikimacro.parameters.reference)
#set+($style+=+$wikimacro.parameters.style)
#set+($type+=+&quot;$!wikimacro.parameters.type&quot;)
#set+($content+=+$services.mentions.format($reference.reference,+$style,+$type))
#set+($anchor+=+$wikimacro.parameters.anchor)
#set+($isCurrentUser+=+$xcontext.userReference+==+$reference.reference+&amp;&amp;+($type+==+''+||+$type++==+'user'))
#set+($cssClasses+=+['xwiki-mention',+'user'])
#if+($isCurrentUser)
++#set+($discard+=+$cssClasses.add('self'))
#end
#set+($link+=+$xwiki.getURL($reference.reference,+'view'))
\{\{html}}
&lt;\a+id=&quot;$escapetool.xml($anchor)&quot;+class=&quot;$stringtool.join($cssClasses,+'+')&quot;+data-reference=&quot;$escapetool.xml($services.model.serialize($reference.reference,+'default'))&quot;+href=&quot;$escapetool.xml($link)&quot;&gt;##
++$escapetool.xml($content)##+Do+not+remove+this+comment+as+it+ensures+that+the+spacing+after+mention+is+not+broken.
&lt;\/a&gt;
\{\{/html}}"+class="macro"><span+class="hidden+macro-placeholder">macro:velocity</span><span+data-macro="startmacro:html|-||-|&lt;\a+id=&quot;XWiki-npetrenko-vmfpml&quot;+class=&quot;xwiki-mention+user+self&quot;+data-reference=&quot;xwiki:XWiki.npetrenko&quot;+href=&quot;/xwiki/bin/view/XWiki/npetrenko&quot;&gt;@Nikita+Petrenko&lt;\/a&gt;"+class="macro"><span+class="hidden+macro-placeholder">macro:html</span><!--startwikilink:xwiki:XWiki.npetrenko--><span+class="wikilink"><a+id="XWiki-npetrenko-vmfpml"+class="xwiki-mention+user+self"+href="/xwiki/bin/view/XWiki/npetrenko">@Nikita+Petrenko</a></span><!--stopwikilink--></span></span></span></span></td><td>Here+is+some+Text</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></tbody></table>
{code}

The *workaround* here is that instead of copying/pasting the entire row, use a separate approach - copy/paste each cell.

My sample of source code

{code:none}
| |{{mention reference="XWiki.npetrenko" style="FULL_NAME" anchor="XWiki-npetrenko-vmfpml"/}}|Here is some Text
| | |
{code}

Also, I don't
know why but after pasting the copied row, CKEditor adds new empty row - so before attempting to save page - I'm ending with 3 rows.