InstallContext should not be available to ModuleVersionHandlers at
instantiation time
-------------------------------------------------------------------------------------
Key: MAGNOLIA-2787
URL: http://jira.magnolia-cms.com/browse/MAGNOLIA-2787
Project: Magnolia
Issue Type: Bug
Components: core
Affects Versions: 4.1
Reporter: Grégory Joseph
Assignee: Philipp Bärfuss
Fix For: 4.2
Considering the following code:
{code}
public class MyModuleVersionHandler extends DefaultModuleVersionHandler {
public MyModuleVersionHandler() {
super();
final ModuleDefinition currentModule =
ModuleManager.Factory.getInstance().getInstallContext().getCurrentModuleDefinition();
System.out.println(currentModule);
}
}
{code}
As of 4.1, this print the ModuleDefinition of the module preceding the one
corresponding to this version handler.
As of 4.1.1, this will return the correct module; to avoid confusion however,
I'd be in favor of preventing this sort of code to run at all. It is hard to
prevent this sort of code from running at the moment because of the singleton
nature of this API. By using IoC, I'm fairly convinced we could achieve
something cleaner.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.magnolia-cms.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------