When email has an invalid address the mail handlers can throw a MessageException

XMLWordPrintable

    • 3.13

      A user in support had their JIRA instance receiving an email with an address that java mail feels is invalid.

      This generates a MessageException in the handleMessage method of our email handlers.

      javax.mail.internet.AddressException: Illegal whitespace in address in string ``jira_gmitbrazil (APPLICATION)''
      at javax.mail.internet.InternetAddress.checkAddress(InternetAddress.java:900)
      at javax.mail.internet.InternetAddress.parse(InternetAddress.java:793)
      at javax.mail.internet.InternetAddress.parseHeader(InternetAddress.java:554)
      at javax.mail.internet.MimeMessage.getAddressHeader(MimeMessage.java:658)
      at javax.mail.internet.MimeMessage.getRecipients(MimeMessage.java:483)
      at javax.mail.Message.getAllRecipients(Message.java:272)
      at javax.mail.internet.MimeMessage.getAllRecipients(MimeMessage.java:498)
      at com.atlassian.mail.MailUtils.hasRecipient(MailUtils.java:254)
      at com.atlassian.jira.service.util.handler.AbstractMessageHandler.canHandleMessage(AbstractMessageHandler.java:206)
      at com.atlassian.jira.service.util.handler.AbstractCommentHandler.handleMessage(AbstractCommentHandler.java:55)
      at com.atlassian.jira.service.services.mail.MailFetcherService.run(MailFetcherService.java:190)
      at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:67)
      at com.atlassian.jira.service.ServiceRunner.execute(ServiceRunner.java:61)
      at org.quartz.core.JobRunShell.run(JobRunShell.java:191)
      at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:516)

      The exception propagates up to the MailFetcherService where all we do is log the exception and leave the mail behind.

      In this case we really want to forward the message on to the forward address (if specified).

      The problem is that the canHandleMessage call is not inside the try/catch that looks for a message exception.

      See JSP-32493 for more details.

            Assignee:
            Unassigned
            Reporter:
            Dylan Etkin [Atlassian]
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 5h Original Estimate - 5h
                5h
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 10h
                10h