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

MailAddressResolver not working properly

    Details

    • Type: Patch
    • Status: Resolved
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Component/s: core
    • Labels:
    • Environment:
      Windows Server 2003, Windows 7, Red Hat linux server 5.3.

      Jenkins is run with java -jar and in a third party servlet container (apache tomcat 6.0)

      Description

      This problem comes from the core but I only could detect it by using the Email-Ext plugin ().

      Here is a description of the problem:

      • When SCM changes are detected during a build, users that do not exist yet are created in Jenkins embedded users db. They are usually created with just a username (and no email address info).
      • The Email-Ext plugin has an option to send emails to commiters. When this option is activated, it tries to resolve addresses for all of them with Jenkins core static method MailAddressResolver.resolve(User u). If the user has no email address configured, the core looks if there is a default email suffix configured with Mailer.descriptor().getDefaultSuffix().
      • If Jenkins has not been configured with a default email suffix, Mailer.descriptor().getDefaultSuffix() returns an empty string. But MailAddressResolver.resolve(User u) only checks if it returns null.
      • All of this implies that MailAddressResolver.resolve(User u) never returns null. Since the Email-Ext plugin relies on this to determine which addresses to send the notifications to, it always send emails (even to non-existing silly addresses without a suffix ). I believe that this must affect other plugins or parts of the application.

      I attached a patch that fixes this behaviour.

      Important note: We currently work with Jenkins 1.424.x LTS. Could this patch be integrated to the LTS release?

        Activity

        Hide
        slide_o_mix Alex Earl added a comment -

        Why not use StringUtils.isBlank/isNotBlank instead? Mailer has been broken out into its own plugin, you could probably submit a pull request for it.

        Show
        slide_o_mix Alex Earl added a comment - Why not use StringUtils.isBlank/isNotBlank instead? Mailer has been broken out into its own plugin, you could probably submit a pull request for it.
        Hide
        danielbeck Daniel Beck added a comment -

        Cannot reproduce:

        hudson.tasks.Mailer.descriptor().getDefaultSuffix().length()
        java.lang.NullPointerException: Cannot invoke method length() on null object

        The mailer plugin source has nullified empty string values set in global config for a long time as well.

        Show
        danielbeck Daniel Beck added a comment - Cannot reproduce: hudson.tasks.Mailer.descriptor().getDefaultSuffix().length() java.lang.NullPointerException: Cannot invoke method length() on null object The mailer plugin source has nullified empty string values set in global config for a long time as well.

          People

          • Assignee:
            Unassigned
            Reporter:
            robinjarry Robin Jarry
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: