Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-4673

MgnlMailFactory fails with NPE when failing to initialise renderer.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Neutral
    • 4.5.7
    • 4.5.4
    • mail
    • None

    Description

              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.

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Bug DoR
                    Task DoD