Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-22535

Exception in createinline.vm when creating top-level pages from ajax requests

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 16.4.2
    • Actions, Menu
    • None
    • Unknown

    Description

      Note : the components in this issue may be incorrect, feel free to put better ones.

      Steps to reproduce :

      • In a new XWiki 16.4.2, create a sub-wiki, let's call it test
      • In the main wiki, create a new menu containing a link to the (inexisting) page : * [[New page 1>>test:Roadmap.WebHome]]
      • Configure the menu so that it is visible after the page header, on the whole farm
      • In the test sub-wiki, click on the abovementioned link to the Roadmap page

      Expected : the creation page modal shows up
      Actual : nothing happens, the following error shows up in the footer :

      Error number 4001 in 4: Error while evaluating velocity template createinline.vm
      com.xpn.xwiki.XWikiException: Error number 4001 in 4: Error while evaluating velocity template createinline.vm
      	at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:2569)
      	at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:180)
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:651)
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:339)
      	at com.xpn.xwiki.web.LegacyActionServlet.service(LegacyActionServlet.java:108)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
      	at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1419)
      	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
      	at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1665)
      	at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:122)
      	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
      	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
      	at org.xwiki.wysiwyg.filter.ConversionFilter.doFilter(ConversionFilter.java:61)
      	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
      	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
      	at org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63)
      	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
      	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
      	at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:132)
      	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
      	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
      	at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208)
      	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
      	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
      	at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:117)
      	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:210)
      	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
      	at org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:170)
      	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
      	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:598)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1580)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1384)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1553)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1306)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
      	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:192)
      	at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:51)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
      	at org.eclipse.jetty.server.Server.handle(Server.java:563)
      	at org.eclipse.jetty.server.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1598)
      	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:753)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:501)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:287)
      	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
      	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
      	at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
      	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:421)
      	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:390)
      	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:277)
      	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:199)
      	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
      	at java.base/java.lang.Thread.run(Thread.java:833)
      Caused by: org.xwiki.rendering.RenderingException: Failed to execute renderer
      	at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.syncRender(DefaultAsyncRendererExecutor.java:287)
      	at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.render(DefaultAsyncRendererExecutor.java:267)
      	at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRendererExecutor.render(DefaultBlockAsyncRendererExecutor.java:154)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:904)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:866)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:846)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:832)
      	at com.xpn.xwiki.internal.template.DefaultTemplateManager.render(DefaultTemplateManager.java:91)
      	at com.xpn.xwiki.internal.template.DefaultTemplateManager.render(DefaultTemplateManager.java:85)
      	at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:2564)
      	... 63 more
      Caused by: org.xwiki.rendering.RenderingException: Failed to evaluate template with id [environment:/templates/createinline.vm]
      	at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.evaluateContent(TemplateAsyncRenderer.java:221)
      	at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.renderVelocity(TemplateAsyncRenderer.java:174)
      	at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.render(TemplateAsyncRenderer.java:135)
      	at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.render(TemplateAsyncRenderer.java:54)
      	at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.lambda$syncRender$0(DefaultAsyncRendererExecutor.java:284)
      	at com.xpn.xwiki.internal.security.authorization.DefaultAuthorExecutor.call(DefaultAuthorExecutor.java:98)
      	at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.syncRender(DefaultAsyncRendererExecutor.java:284)
      	... 72 more
      Caused by: org.xwiki.velocity.XWikiVelocityException: Failed to evaluate content with namespace [environment:/templates/createinline.vm]
      	at org.xwiki.velocity.internal.InternalVelocityEngine.evaluate(InternalVelocityEngine.java:227)
      	at com.xpn.xwiki.internal.template.VelocityTemplateEvaluator.evaluateContent(VelocityTemplateEvaluator.java:105)
      	at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.evaluateContent(TemplateAsyncRenderer.java:219)
      	... 78 more
      Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'createDocumentReference' in  class org.xwiki.model.script.ModelScriptService threw exception java.lang.IllegalArgumentException: Invalid parent reference [null] in a document reference at environment:/templates/createinline.vm[line 400, column 62]
      	at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:308)
      	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:235)
      	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:368)
      	at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:704)
      	at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:75)
      	at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:242)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
      	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:171)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:439)
      	at org.apache.velocity.Template.merge(Template.java:358)
      	at org.apache.velocity.Template.merge(Template.java:262)
      	at org.xwiki.velocity.internal.InternalVelocityEngine.evaluate(InternalVelocityEngine.java:225)
      	... 80 more
      Caused by: java.lang.IllegalArgumentException: Invalid parent reference [null] in a document reference
      	at org.xwiki.model.reference.DocumentReference.setParent(DocumentReference.java:246)
      	at org.xwiki.model.reference.EntityReference.<init>(EntityReference.java:157)
      	at org.xwiki.model.reference.AbstractLocalizedEntityReference.<init>(AbstractLocalizedEntityReference.java:76)
      	at org.xwiki.model.reference.DocumentReference.<init>(DocumentReference.java:177)
      	at org.xwiki.model.script.ModelScriptService.createDocumentReference(ModelScriptService.java:146)
      	at jdk.internal.reflect.GeneratedMethodAccessor795.invoke(Unknown Source)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:571)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:554)
      	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:221)
      	... 90 more
      

      Note 1 : if you try to have the same set-up with a link to a page that is not a top-level page (for example, test:Roadmap.Page1.WebHome), the issue doesn't occur.
      Note 2 : There is probably an easier way to reproduce this issue, but I'm not completely sure how.

      By digging a little bit, I found out that the source of the issue could come from https://github.com/xwiki/xwiki-platform/blob/82ba90784232fd5947c70b74bbbcfc67a245aca1/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/CreateActionRequestHandler.java#L317 ; the spaceReference is then re-used in the velocity template.

      Attachments

        Activity

          People

            Unassigned Unassigned
            caubin Clément Aubin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: