Uploaded image for project: 'Jira Cloud'
  1. Jira Cloud
  2. JRACLOUD-66255

Null pointer exception when attaching files from emails to comments

    XMLWordPrintable

Details

    Description

      This is a bug found while triaging: https://support.atlassian.com/browse/JST-60176

      Since the latest upgrade of the JIRA OnDemand instance the AttachmentManager has been broken while attaching files to comments.

      Stack Trace

      2013-03-26 15:49:42,902 ERROR [SupportEmails] QuartzScheduler_Worker-2 ServiceRunner    Support Emails Exception while creating attachment for issue SPT-5008: java.lang.NullPointerException
      java.lang.NullPointerException
              at com.atlassian.jira.issue.managers.DefaultAttachmentManager.createAttachmentBean(DefaultAttachmentManager.java:409)
              at com.atlassian.jira.issue.managers.DefaultAttachmentManager.createAttachment(DefaultAttachmentManager.java:378)
              at com.atlassian.jira.issue.managers.DefaultAttachmentManager.createAttachment(DefaultAttachmentManager.java:371)
              at com.atlassian.jira.issue.managers.DefaultAttachmentManager.createAttachment(DefaultAttachmentManager.java:462)
              at com.atlassian.jira.service.util.handler.DefaultMessageHandlerContext.createAttachment(DefaultMessageHandlerContext.java:83)
              at com.atlassian.jira.service.services.mail.DelegatingMessageHandlerContext.createAttachment(DelegatingMessageHandlerContext.java:53)
              at com.atlassian.jira.plugins.mail.handlers.AbstractMessageHandler.createAttachmentWithPart(AbstractMessageHandler.java:978)
              at com.atlassian.jira.plugins.mail.handlers.AbstractMessageHandler$1.handlePart(AbstractMessageHandler.java:572)
              at com.atlassian.jira.plugins.mail.handlers.AbstractMessageHandler.handleMultipart(AbstractMessageHandler.java:661)
              at com.atlassian.jira.plugins.mail.handlers.AbstractMessageHandler.createAttachmentsForMessage(AbstractMessageHandler.java:622)
              at com.atlassian.jira.plugins.mail.handlers.AbstractCommentHandler.handleMessage(AbstractCommentHandler.java:138)
              at com.atlassian.jira.plugins.mail.handlers.CreateOrCommentHandler.handleMessage(CreateOrCommentHandler.java:112)
              at com.atlassian.jira.service.services.mail.MailFetcherService$1.process(MailFetcherService.java:368)
              at com.atlassian.jira.service.services.mail.MailFetcherService$MessageProviderImpl.getAndProcessMail(MailFetcherService.java:271)
              at com.atlassian.jira.service.services.mail.MailFetcherService.runImpl(MailFetcherService.java:356)
              at com.atlassian.jira.service.services.file.AbstractMessageHandlingService.run(AbstractMessageHandlingService.java:257)
              at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:61)
              at com.atlassian.jira.service.ServiceRunner.execute(ServiceRunner.java:48)
              at org.quartz.core.JobRunShell.run(JobRunShell.java:195)
              at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
      

      Possible Culprit Commit

      cc920660309f76fbf94a1be86f03c779e1fd740c

      Cause of exception

      In file DefaultAttachmentManager.java on line 408/409 an attachment is create using the createAttachment function found on line 412. This function can return null, e.g. if the file or filename is null, therefore on line 409 when they try to call getId on the variable 'attachment' a null pointer exception is thrown as attachment is null.

      Advice

      CreateAttachment functions need to be cleaned up, I could not understand what was going on as there are 10 createAttachment functions and so could not figure out a workaround, therefore pushing this quickly would be appreciative for the customer.

      Attachments

        Issue Links

          Activity

            People

              jhazelwood James Hazelwood
              jashmore jashmore@atlassian.com (Inactive)
              Votes:
              15 Vote for this issue
              Watchers:
              27 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: