This issue has been created
There is 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-047ccf4f-f9aa-487f-af7f-6407fcedbd4c XWIKI-22659 Open

createinline template error when clicking on a link to missing top level page

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-e7a85cf3-1b06-407e-88a9-599adb2e5b4e Simon Urli created this issue on 14/Nov/24 16:54
 
Summary: createinline template error when clicking on a link to missing top level page
Issue Type: cid:jira-generated-image-avatar-047ccf4f-f9aa-487f-af7f-6407fcedbd4c Bug
Affects Versions: 15.10.11, 16.9.0
Assignee: Unassigned
Attachments: image-2024-11-14-16-53-47-404.png
Components: Web - Templates & Resources
Created: 14/Nov/24 16:54
Priority: cid:jira-generated-image-static-major-78526efd-9f54-4011-8604-668d55b66861 Major
Reporter: Simon Urli
Description:

Reproduction steps:

  • Create a page containing [[B>>xwiki:B.WebHome]]
  • Click on the link to create that page

Expected result:

  • A modal is opened to propose creating that page

Obtained result:

  • An error appears in the UI: _thumb_42921.png
  • The following stacktrace appears in the console:
    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:107)
    	at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.evaluateContent(TemplateAsyncRenderer.java:219)
    	... 81 common frames omitted
    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)
    	... 83 common frames omitted
    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:158)
    	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.GeneratedMethodAccessor573.invoke(Unknown Source)
    	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
    	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)
    	... 93 common frames omitted
    
 
 

1 comment

 
cid:jira-generated-image-avatar-e7a85cf3-1b06-407e-88a9-599adb2e5b4e Simon Urli on 14/Nov/24 16:56
 

The error is partly caused by the fact that CreateActionRequestHandler#processNewDocument computes a null space and so the spaceReference script context parameter is set to null in CreateAction. But that's actually the expected value in such case: the wrong logic seems to be in createinline.vm.