MgnlMailFactory fails with NPE when failing to initialise renderer
------------------------------------------------------------------

                 Key: MGNLMAIL-3
                 URL: http://jira.magnolia-cms.com/browse/MGNLMAIL-3
             Project: Magnolia Mail Module
          Issue Type: Bug
            Reporter: Roman Kovařík
            Assignee: Roman Kovařík


{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: <dev-list-unsubscr...@magnolia-cms.com>
----------------------------------------------------------------

Reply via email to