Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 4.1.3
-
Fix Version/s: 4.1.4, 4.2-milestone-1
-
Component/s: Script
-
Labels:None
-
Documentation:N/A
-
Documentation in Release Notes:
-
Similar issues:
XCOMMONS-132 Add support for scripting in Scala XCOMMONS-267 Add script service helper base class XCOMMONS-232Component get always injected with root ComponentManager instead of it's own Component Manager XCOMMONS-174No core extension found on Windows 7 XCOMMONS-332Installed Extensions are not searchable in upper case XCOMMONS-213 When installing the same extension on differents namespaces only one listener will be registered XCOMMONS-274An installed extension is tagged as dependencies for all namespaces XCOMMONS-345Error when installing non local extension on several namespaces XCOMMONS-242Make it easy to access the Execution Context from a script XCOMMONS-154Allow stopping Groovy scripts if they take longer that a given time to execute
Description
I don't know if this is a recent regression or not.
To reproduce:
- Install xwiki-platform-git module using the EM UI
- Create a page with
{{velocity}}
$services.git
{{/velocity}}
- Verify that it's not resolved properly
- Then clean up your data/extension directory and copy the 4 depds to WEB-INF/lib (gitective, xwiki-platform-git, jgit and jsch)
- Go again to the page and verify it works this time
Issue Links
- depends on
-
XCOMMONS-230
Add Provider to get the "context" ComponentManager
-
The issue is that DefaultScriptManager use the root ComponentManager to lookup services and in this case the service is not in the root ComponentManager. Like wiki macros manager it should use the "context" ComponentManager.
I actually tough the "context" ComponentManager was the default ComponentManager specifically to avoid issues like that. If we don't do that it mean it has to be handled specifically everywhere we need to dynamically lookup something like wiki macros and script services but this looks like quite a pain (just look at what org.xwiki.rendering.internal.macro.DefaultMacroManager#getComponentManager() has to do) when setting "context" ComponentManager as default ComponentManager means there is nothing to do.