Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-14338

NPE when retrieving "requester" address for a promoted build

      We have started receiving NPE's during email creation. The issue goes away if we deselect the option to include the requester in the recipient list. A stack trace is below.

      Jul 06, 2012 8:09:23 AM hudson.plugins.emailext.ExtendedEmailPublisher sendMail
      WARNING: Could not send email.
      java.lang.NullPointerException
      at hudson.plugins.emailext.ExtendedEmailPublisher.createMail(ExtendedEmailPublisher.java:415)
      at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:273)
      at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:265)
      at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:225)
      at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:717)
      at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:692)
      at hudson.model.Build$BuildExecution.cleanUp(Build.java:192)
      at hudson.model.Run.execute(Run.java:1528)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:236)

      Thank you!

          [JENKINS-14338] NPE when retrieving "requester" address for a promoted build

          Alex Earl added a comment -

          What version

          Alex Earl added a comment - What version

          Mark MacVicar added a comment -

          This is occurring for us with:
          Jenkins: 1.504
          Mailer: 1.4
          Email-ext: 2.27.1

          The error we get is

          Sending email for trigger: Success
          ERROR: Could not send email as a part of the post-build publishers.
          java.lang.NullPointerException
          at hudson.plugins.emailext.ExtendedEmailPublisher.createMail(ExtendedEmailPublisher.java:535)
          at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:304)
          at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:296)
          at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:256)
          at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
          at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:814)
          at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:786)
          at hudson.model.Build$BuildExecution.cleanUp(Build.java:192)
          at hudson.model.Run.execute(Run.java:1612)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
          at hudson.model.ResourceController.execute(ResourceController.java:88)
          at hudson.model.Executor.run(Executor.java:237)

          Most jobs work ok with requester checked, but a few jobs always report this error when requester is checked.

          Mark MacVicar added a comment - This is occurring for us with: Jenkins: 1.504 Mailer: 1.4 Email-ext: 2.27.1 The error we get is Sending email for trigger: Success ERROR: Could not send email as a part of the post-build publishers. java.lang.NullPointerException at hudson.plugins.emailext.ExtendedEmailPublisher.createMail(ExtendedEmailPublisher.java:535) at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:304) at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:296) at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:256) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:814) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:786) at hudson.model.Build$BuildExecution.cleanUp(Build.java:192) at hudson.model.Run.execute(Run.java:1612) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:237) Most jobs work ok with requester checked, but a few jobs always report this error when requester is checked.

          Alex Earl added a comment -

          Looks like its in this code (which I think is different from the original submitter of the issue)

          while (upc != null) {
              // UpstreamCause.getUpStreamProject() returns the full name, so use getItemByFullName
              AbstractProject<?, ?> p = (AbstractProject<?, ?>) Hudson.getInstance().getItemByFullName(upc.getUpstreamProject());
              cur = p.getBuildByNumber(upc.getUpstreamBuild()); // line 535
              upc = cur.getCause(Cause.UpstreamCause.class);
          }
          

          I guess p could be null

          Alex Earl added a comment - Looks like its in this code (which I think is different from the original submitter of the issue) while (upc != null ) { // UpstreamCause.getUpStreamProject() returns the full name, so use getItemByFullName AbstractProject<?, ?> p = (AbstractProject<?, ?>) Hudson.getInstance().getItemByFullName(upc.getUpstreamProject()); cur = p.getBuildByNumber(upc.getUpstreamBuild()); // line 535 upc = cur.getCause(Cause.UpstreamCause.class); } I guess p could be null

          Alex Earl added a comment -

          Added check to see if returned project is null before trying to use it.

          Alex Earl added a comment - Added check to see if returned project is null before trying to use it.

          Code changed in jenkins
          User: Alex Earl
          Path:
          src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java
          http://jenkins-ci.org/commit/email-ext-plugin/a8280bcc3a91bb542091ef2a4eff3a57892dce26
          Log:
          Fix JENKINS-14338

          Added check to see if AbstractProject is null before trying to use it.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Alex Earl Path: src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java http://jenkins-ci.org/commit/email-ext-plugin/a8280bcc3a91bb542091ef2a4eff3a57892dce26 Log: Fix JENKINS-14338 Added check to see if AbstractProject is null before trying to use it.

            slide_o_mix Alex Earl
            asedlackparts Aron Sedlack
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: