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

Mail not sent: NullPointerException in plugins.ContentBuilder.transformText(ContentBuilder.java:68)

      email-ext fails with a NullPointerException when sending some emails (not all).

      I am not a java developer but if someone could send me a version of email-ext having this line (ContentBuilder.java:68) devided in several lines, next time it fails we could locate more precisely the error.

      Here is the stack I have:
      ----------------------------------------------
      Build step 'Execute shell' marked build as failure
      Email was triggered for: Failure
      Sending email for trigger: Failure
      ERROR: Could not send email as a part of the post-build publishers.
      java.lang.NullPointerException
      at java.util.regex.Matcher.quoteReplacement(Matcher.java:598)
      at hudson.plugins.emailext.plugins.ContentBuilder.transformText(ContentBuilder.java:68)
      at hudson.plugins.emailext.ExtendedEmailPublisher.setSubject(ExtendedEmailPublisher.java:463)
      at hudson.plugins.emailext.ExtendedEmailPublisher.createMail(ExtendedEmailPublisher.java:311)
      at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:259)
      at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:251)
      at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:211)
      at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
      at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:703)
      at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:678)
      at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:656)
      at hudson.model.Build$RunnerImpl.cleanUp(Build.java:171)
      at hudson.model.Run.run(Run.java:1454)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:238)
      Finished: FAILURE

          [JENKINS-13317] Mail not sent: NullPointerException in plugins.ContentBuilder.transformText(ContentBuilder.java:68)

          shinsato added a comment -

          A version of 2.20-SNAPSHOT with some debugging for the ContentBuilder.transformText code to make it easier to see where the null String is being introduced.

          shinsato added a comment - A version of 2.20-SNAPSHOT with some debugging for the ContentBuilder.transformText code to make it easier to see where the null String is being introduced.

          shinsato added a comment -

          This is definitely a bug - the defaultBody is set to null with a method nullify if the contents of the default body for the ExtendedEmailPublisher are empty.

          shinsato added a comment - This is definitely a bug - the defaultBody is set to null with a method nullify if the contents of the default body for the ExtendedEmailPublisher are empty.

          shinsato added a comment -

          Pull request sent to maintainers with fix. Given that null is a valid value for some the variables associated with this problem, I screened out null values and passed empty string instead to the Matcher.quoteReplacement calls.

          shinsato added a comment - Pull request sent to maintainers with fix. Given that null is a valid value for some the variables associated with this problem, I screened out null values and passed empty string instead to the Matcher.quoteReplacement calls.

          Krip added a comment -

          Thanks a lot Shinsato.
          I have no failing jobs to test right now (which is a good thing in fact ).

          I'll try to reproduce the issue with the previous logs though.
          I'll post here my results.

          Regards

          Krip added a comment - Thanks a lot Shinsato. I have no failing jobs to test right now (which is a good thing in fact ). I'll try to reproduce the issue with the previous logs though. I'll post here my results. Regards

          Code changed in jenkins
          User: slide
          Path:
          src/main/java/hudson/plugins/emailext/plugins/ContentBuilder.java
          src/test/java/hudson/plugins/emailext/plugins/ContentBuilderTest.java
          http://jenkins-ci.org/commit/email-ext-plugin/a75006ea9298eaaf66183ca283fb14016ed90840
          Log:
          Merge pull request #38 from hajush/master

          Fix JENKINS-13317 - prevent null String derefences from the default Subject, Body, Recipient lists.

          Compare: https://github.com/jenkinsci/email-ext-plugin/compare/8e08512...a75006e

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: slide Path: src/main/java/hudson/plugins/emailext/plugins/ContentBuilder.java src/test/java/hudson/plugins/emailext/plugins/ContentBuilderTest.java http://jenkins-ci.org/commit/email-ext-plugin/a75006ea9298eaaf66183ca283fb14016ed90840 Log: Merge pull request #38 from hajush/master Fix JENKINS-13317 - prevent null String derefences from the default Subject, Body, Recipient lists. Compare: https://github.com/jenkinsci/email-ext-plugin/compare/8e08512...a75006e

          Alex Earl added a comment -

          Should be a release of 2.20 soon.

          Alex Earl added a comment - Should be a release of 2.20 soon.

          shinsato added a comment -

          This was fixed in 2.20

          shinsato added a comment - This was fixed in 2.20

            shinsato shinsato
            krissap Krip
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: