[
http://jira.magnolia-cms.com/browse/MAGNOLIA-4673?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jan Haderka reopened MAGNOLIA-4673:
-----------------------------------
This issue needs to be cloned to MGNLMAIL and fix on master of mail module as
well.
Further more rather then using {{quietNewInstance()}} and then checking the
null and throwing exception:
{code}
mail = Classes.quietNewInstance(rendererClass, template);
+ throw new Exception("Failure to instantiate rendererclass: " +
rendererClass + ".");
{code}
you should use just {{Classes.newInstance()}} and let the exception that is
thrown from this method go through instead.
> MgnlMailFactory fails with NPE when failing to initialise renderer.
> -------------------------------------------------------------------
>
> Key: MAGNOLIA-4673
> URL: http://jira.magnolia-cms.com/browse/MAGNOLIA-4673
> Project: Magnolia
> Issue Type: Bug
> Security Level: Public
> Components: mail
> Affects Versions: 4.5.4
> Reporter: Jan Haderka
> Assignee: Roman Kovařík
> Fix For: 4.5.7
>
>
> {noformat}
> if(renderers.containsKey(template.getType().toLowerCase())){
> String rendererClass =
> renderers.get(template.getType().toLowerCase());
> mail = Classes.quietNewInstance(rendererClass, template);
> }
> else {
> mail = new SimpleEmail(template);
> }
> {noformat}
> {{quietNewInstance()}} will return null in case of failure to instantiate
> renderer. This leads to NPE later down in the code when attempting to set
> properties on {{mail}}.
> I believe that failure to create renderer should not be swallowed but
> propagated up to calling code.
> Also code above should be able to handle situation when template type is not
> specified at all (And choose {{SimpleMail}} like in case of unrecognized
> renderer.
--
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/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------