[xwiki-devs] Regression in inline edition
Hi (Thomas), I’ve found a regression while analyzing why http://ci.xwiki.org/job/xwiki-platform/org.xwiki.platform$xwiki-platform-rel... is failing. The inline action works fine and correctly sets the cdoc (which contains the template content copied to the new doc). The issue is that when inline.vm executes (evaluateTemplate()), this calls getVelocityContext() which calls XWikiScriptContextInitializer and this line (added in rev 955505595b95784876777a7059fb3bc725c01776) is executed: setDocument(scriptContext, "cdoc", cdoc, xcontext); This line executes: private void setDocument(ScriptContext scriptContext, String key, XWikiDocument document, XWikiContext xcontext) { Document previousDoc = (Document) scriptContext.getAttribute(key); if (previousDoc == null || !previousDoc.getDocumentReference().equals(document.getDocumentReference())) { Document apiDocument = document.newDocument(xcontext); scriptContext.setAttribute(key, apiDocument, ScriptContext.ENGINE_SCOPE); } } And since there’s a previousDoc, it’s set as the cdoc and thus then editinline.vm executes the cdoc is the original one and not the one modified by the InlineAction.java code (ie with the template copied). Apparently this commit was done in: https://github.com/xwiki/xwiki-platform/commit/955505595b95784876777a7059fb3... @Thomas: could I let you handle this? (since I don’t know this code and its logic). Thanks -Vincent
I will take care of this. On Sat, Aug 20, 2016 at 10:11 PM, Vincent Massol <[email protected]> wrote:
Hi (Thomas),
I’ve found a regression while analyzing why http://ci.xwiki.org/job/xwiki-platform/org.xwiki.platform$xwiki-platform-rel... is failing.
The inline action works fine and correctly sets the cdoc (which contains the template content copied to the new doc).
The issue is that when inline.vm executes (evaluateTemplate()), this calls getVelocityContext() which calls XWikiScriptContextInitializer and this line (added in rev 955505595b95784876777a7059fb3bc725c01776) is executed:
setDocument(scriptContext, "cdoc", cdoc, xcontext);
This line executes:
private void setDocument(ScriptContext scriptContext, String key, XWikiDocument document, XWikiContext xcontext) { Document previousDoc = (Document) scriptContext.getAttribute(key); if (previousDoc == null || !previousDoc.getDocumentReference().equals(document.getDocumentReference())) { Document apiDocument = document.newDocument(xcontext); scriptContext.setAttribute(key, apiDocument, ScriptContext.ENGINE_SCOPE); } }
And since there’s a previousDoc, it’s set as the cdoc and thus then editinline.vm executes the cdoc is the original one and not the one modified by the InlineAction.java code (ie with the template copied).
Apparently this commit was done in: https://github.com/xwiki/xwiki-platform/commit/955505595b95784876777a7059fb3...
@Thomas: could I let you handle this? (since I don’t know this code and its logic).
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
Is it done? 2016-08-22 10:29 GMT+02:00 Thomas Mortagne <[email protected]>:
I will take care of this.
On Sat, Aug 20, 2016 at 10:11 PM, Vincent Massol <[email protected]> wrote:
Hi (Thomas),
I’ve found a regression while analyzing why http://ci.xwiki.org/job/xwiki-platform/org.xwiki.platform$ xwiki-platform-release-test-tests/3127/testReport/org. xwiki.release.test.ui/ReleaseTest/testRelease/ is failing.
The inline action works fine and correctly sets the cdoc (which contains the template content copied to the new doc).
The issue is that when inline.vm executes (evaluateTemplate()), this calls getVelocityContext() which calls XWikiScriptContextInitializer and this line (added in rev 955505595b95784876777a7059fb3bc725c01776) is executed:
setDocument(scriptContext, "cdoc", cdoc, xcontext);
This line executes:
private void setDocument(ScriptContext scriptContext, String key, XWikiDocument document, XWikiContext xcontext) { Document previousDoc = (Document) scriptContext.getAttribute(key); if (previousDoc == null || !previousDoc. getDocumentReference().equals(document.getDocumentReference())) { Document apiDocument = document.newDocument(xcontext); scriptContext.setAttribute(key, apiDocument, ScriptContext.ENGINE_SCOPE); } }
And since there’s a previousDoc, it’s set as the cdoc and thus then editinline.vm executes the cdoc is the original one and not the one modified by the InlineAction.java code (ie with the template copied).
Apparently this commit was done in: https://github.com/xwiki/xwiki-platform/commit/ 955505595b95784876777a7059fb3bc725c01776#diff- bf8a5403fbc32bd20f7f3687062f1a24R105
@Thomas: could I let you handle this? (since I don’t know this code and its logic).
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Guillaume Delhumeau ([email protected]) Research & Development Engineer at XWiki SAS Committer on the XWiki.org project
Should be better now yes. On Mon, Aug 22, 2016 at 12:11 PM, Guillaume Delhumeau <[email protected]> wrote:
Is it done?
2016-08-22 10:29 GMT+02:00 Thomas Mortagne <[email protected]>:
I will take care of this.
On Sat, Aug 20, 2016 at 10:11 PM, Vincent Massol <[email protected]> wrote:
Hi (Thomas),
I’ve found a regression while analyzing why http://ci.xwiki.org/job/xwiki-platform/org.xwiki.platform$ xwiki-platform-release-test-tests/3127/testReport/org. xwiki.release.test.ui/ReleaseTest/testRelease/ is failing.
The inline action works fine and correctly sets the cdoc (which contains the template content copied to the new doc).
The issue is that when inline.vm executes (evaluateTemplate()), this calls getVelocityContext() which calls XWikiScriptContextInitializer and this line (added in rev 955505595b95784876777a7059fb3bc725c01776) is executed:
setDocument(scriptContext, "cdoc", cdoc, xcontext);
This line executes:
private void setDocument(ScriptContext scriptContext, String key, XWikiDocument document, XWikiContext xcontext) { Document previousDoc = (Document) scriptContext.getAttribute(key); if (previousDoc == null || !previousDoc. getDocumentReference().equals(document.getDocumentReference())) { Document apiDocument = document.newDocument(xcontext); scriptContext.setAttribute(key, apiDocument, ScriptContext.ENGINE_SCOPE); } }
And since there’s a previousDoc, it’s set as the cdoc and thus then editinline.vm executes the cdoc is the original one and not the one modified by the InlineAction.java code (ie with the template copied).
Apparently this commit was done in: https://github.com/xwiki/xwiki-platform/commit/ 955505595b95784876777a7059fb3bc725c01776#diff- bf8a5403fbc32bd20f7f3687062f1a24R105
@Thomas: could I let you handle this? (since I don’t know this code and its logic).
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Guillaume Delhumeau ([email protected]) Research & Development Engineer at XWiki SAS Committer on the XWiki.org project _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
participants (3)
-
Guillaume Delhumeau -
Thomas Mortagne -
Vincent Massol