|
Summary: |
Invalid HTML is generated Erorr in WYSIWYG when saving page after copy and paste /pasting a row with mentioned macro and text into row of the table mention macro |
Version: |
16.6.0 |
Version: |
15.10.11 |
Version: |
15.10.11 |
Version: |
16.6.0 |
Description: |
After following steps from 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 mention macro and mention the current user (XWiki Admin) into cell 2 and some text into 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 [ XRENDERING http - 753|https nio-7635-exec-8 - http :// jira 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 / browse 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 / XRENDERING-753], 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 WYSIWYG editor generates a velocity save { code inside HTML }http://localhost:7635/xwiki/bin/save/Sandbox/Table%20With%20Mentioning/{code} will return 400 status error . The source view will contain the following wrong content:
{code:none} <table><tbody><tr><td> </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> </td><td><span + tabindex="-1" + contenteditable="false"><span + data-macro="startmacro:mention|-|reference="XWiki.npetrenko" + style="FULL_NAME" + anchor="XWiki-npetrenko-vmfpml"" + 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 + = + "$!wikimacro.parameters.type") #set + ($content + = + $services.mentions.format($reference.reference, + $style, + $type)) #set + ($anchor + = + $wikimacro.parameters.anchor) #set + ($isCurrentUser + = + $xcontext.userReference + == + $reference.reference + && + ($type + == + '' + || + $type ++ == + 'user')) #set + ($cssClasses + = + ['xwiki-mention', + 'user']) #if + ($isCurrentUser) ++ #set + ($discard + = + $cssClasses.add('self')) #end #set + ($link + = + $xwiki.getURL($reference.reference, + 'view')) \{\{html}} <\a + id="$escapetool.xml($anchor)" + class="$stringtool.join($cssClasses, + ' + ')" + data-reference="$escapetool.xml($services.model.serialize($reference.reference, + 'default'))" + href="$escapetool.xml($link)">## ++ $escapetool.xml($content)## + Do + not + remove + this + comment + as + it + ensures + that + the + spacing + after + mention + is + not + broken. <\/a> \{\{/html}}" + class="macro"><span + class="hidden + macro-placeholder">macro:velocity</span><span + data-macro="startmacro:html|-||-|<\a + id="XWiki-npetrenko-vmfpml" + class="xwiki-mention + user + self" + data-reference="xwiki:XWiki.npetrenko" + href="/xwiki/bin/view/XWiki/npetrenko">@Nikita + Petrenko<\/a>" + 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> </td><td> </td><td> </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. |
Project: |
XWiki Rendering Platform |
Component: |
Syntax - xwiki/2.1 |
Component: |
CKEditor |
Component: |
Syntax - xhtml/1.0 & html/4.01 |
Key: |
XRENDERING XWIKI - 754 22391 |
|