Uploaded image for project: 'Magnolia Mail Module'
  1. Magnolia Mail Module
  2. MGNLMAIL-3

MgnlMailFactory fails with NPE when failing to initialise renderer

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 5.0
    • None
    • None
    • None

              if(renderers.containsKey(template.getType().toLowerCase())){
                  String rendererClass = renderers.get(template.getType().toLowerCase());
                  mail = Classes.quietNewInstance(rendererClass, template);
              }
              else {
                  mail = new SimpleEmail(template);
              }
      

      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.

        Acceptance criteria

              rkovarik Roman Kovařík
              rkovarik Roman Kovařík
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD