[ 
https://issues.jenkins-ci.org/browse/JENKINS-13064?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robin Jarry updated JENKINS-13064:
----------------------------------

    Description: 
This problem comes from the core but I only could detect it by using the 
[Email-Ext plugin|https://wiki.jenkins-ci.org/display/JENKINS/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|https://wiki.jenkins-ci.org/display/JENKINS/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|https://wiki.jenkins-ci.org/display/JENKINS/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.

{panel:bgColor=#FFFFCE}Important note: We currently work with *Jenkins 1.424.x 
LTS*. Could this patch be integrated to the LTS release?{panel}


  was:
This problem comes from the core but I only could detect it by using the 
[Email-Ext plugin|https://wiki.jenkins-ci.org/display/JENKINS/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|https://wiki.jenkins-ci.org/display/JENKINS/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|https://wiki.jenkins-ci.org/display/JENKINS/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.

{panel:bgColor=#FFFFCE}Important note: At *Thales*, we currently work with 
*Jenkins 1.424.x LTS*. Could this patch be integrated to the LTS release?{panel}


    
> MailAddressResolver not working properly
> ----------------------------------------
>
>                 Key: JENKINS-13064
>                 URL: https://issues.jenkins-ci.org/browse/JENKINS-13064
>             Project: Jenkins
>          Issue Type: Patch
>          Components: core
>         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)
>            Reporter: Robin Jarry
>              Labels: email
>         Attachments: empty-email-suffix.patch
>
>
> This problem comes from the core but I only could detect it by using the 
> [Email-Ext 
> plugin|https://wiki.jenkins-ci.org/display/JENKINS/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|https://wiki.jenkins-ci.org/display/JENKINS/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|https://wiki.jenkins-ci.org/display/JENKINS/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.
> {panel:bgColor=#FFFFCE}Important note: We currently work with *Jenkins 
> 1.424.x LTS*. Could this patch be integrated to the LTS release?{panel}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to