This issue has been created
There are 2 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-4b9c4a26-2cbe-495b-8ecf-f5b7e4cf789f XWIKI-25587 Open

Possible NullPointerException when evaluating UI extension parameters without a current wiki

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-68f8a425-c1da-4859-963f-6c66efb44acb Vincent Massol created this issue on 24/Oct/26 09:21
 
Summary: Possible NullPointerException when evaluating UI extension parameters without a current wiki
Issue Type: cid:jira-generated-image-avatar-4b9c4a26-2cbe-495b-8ecf-f5b7e4cf789f Bug
Affects Versions: 5.0-milestone-1
Assignee: Unassigned
Components: UI Extension
Created: 24/Oct/26 09:21
Priority: cid:jira-generated-image-static-major-7887079a-75b4-4250-9c45-f66b5462d2e2 Major
Reporter: Vincent Massol
Description:

When the parameters of a wiki UI extension contain a script (Velocity or a localization shortcut) and they are requested in a context where there is no current wiki (for example from a thread where no XWiki context has been initialized), WikiUIExtensionParameters#get() fails with a NullPointerException instead of returning the parameters.

The cause is that the current wiki used as the key of the evaluated parameters cache is computed with modelContext.getCurrentEntityReference().extractReference(EntityType.WIKI).getName(), and ModelContext#getCurrentEntityReference() returns null when there is no execution context, no XWiki context, or no wiki set in it.

The code dates from XWIKI-8845. It was reported by SonarCloud (rule javabugs:S2259) after XWIKI-25421 re-wrapped the line, which made it count as new code and turned the master quality gate red.

Expected

The parameters are evaluated as usual and cached for "no current wiki", and they are evaluated again once a wiki is set in the context.

 
 

2 updates

 
cid:jira-generated-image-avatar-68f8a425-c1da-4859-963f-6c66efb44acb Changes by Vincent Massol on 24/Oct/26 09:21
 
Fix Version: 18.10.0-rc-1
Assignee: Vincent Massol