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
             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]>
----------------------------------------------------------------

Reply via email to