Uploaded image for project: 'OpenNMS'
  1. OpenNMS
  2. NMS-5665

JavaSendMailer throws NPE when no e-mail address configured for report

    XMLWordPrintable

    Details

      Description

      Steps to reproduce:

      1. Ensure that an SMTP MTA is listening on 127.0.0.1. It need not be capable of actually delivery, only of completing a basic EHLO / NOOP / QUIT conversation.

      2. Edit reportd-configuration.xml to run a known-working report with no recipients specified. The following works for me (note this results in a report being run every minute, so remember to turn it off):

      <report report-name="sample-report" report-template="Early-Morning-Report.jrxml" report-engine="jdbc">
      <cron-schedule>0 * * * * ? *</cron-schedule>
      </report>

      3. Reload Reportd's configuration:

      send-event.pl uei.opennms.org/internal/reloadDaemonConfig -p 'daemonName Reportd'

      4. Watch the event list and reportd.log

      Expected result: everything pretty cool since we didn't ask for any e-mail delivery on this report
      Actual result:

      A. An event with UEI uei.opennms.org/reportd/reportDeliveryFailed and log message "The report with name sample-report could not be delivered for the following reason: Caught unexpected java.lang.NullPointerException: null"

      B. An exception stack trace in reportd.log like the following:

      2012-11-27 10:43:00,203 ERROR [reportd_Worker-8] JavaMailDeliveryService: Unexpected exception: null
      java.lang.NullPointerException
      at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:599)
      at org.opennms.javamail.JavaSendMailer.send(JavaSendMailer.java:271)
      at org.opennms.javamail.JavaSendMailer.send(JavaSendMailer.java:247)
      at org.opennms.netmgt.reporting.service.JavaMailDeliveryService.deliverReport(JavaMailDeliveryService.java:75)
      at org.opennms.netmgt.reporting.service.Reportd.runReport(Reportd.java:114)
      at org.opennms.netmgt.reporting.service.ReportJob.execute(ReportJob.java:54)
      at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
      at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)

        Attachments

          Activity

            People

            • Assignee:
              jeffg Jeff Gehlbach
              Reporter:
              jeffg Jeff Gehlbach
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: