continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmora...@apache.org
Subject svn commit: r800811 - /continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java
Date Tue, 04 Aug 2009 14:15:43 GMT
Author: jmorales
Date: Tue Aug  4 14:15:43 2009
New Revision: 800811

URL: http://svn.apache.org/viewvc?rev=800811&view=rev
Log:
[CONTINUUM-2281] Same Recipiant will be added several times in Notification.

Modified:
    continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java?rev=800811&r1=800810&r2=800811&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java
Tue Aug  4 14:15:43 2009
@@ -27,8 +27,10 @@
 import java.util.Arrays;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import javax.mail.Message;
 import javax.mail.MessagingException;
@@ -692,6 +694,7 @@
 
             if ( StringUtils.isEmpty( toOverride ) )
             {
+                Set<String> listRecipents = new HashSet<String>();
                 for ( ProjectNotifier notifier : notifiers )
                 {
                     Map<String, String> conf = notifier.getConfiguration();
@@ -704,11 +707,15 @@
                             String[] addresses = StringUtils.split( addressField, "," );
                             for ( String address : addresses )
                             {
-                                // TODO: set a proper name
-                                InternetAddress to = new InternetAddress( address.trim()
);
-
-                                log.info( "Recipient: To '" + to + "'." );
-                                message.addRecipient( Message.RecipientType.TO, to );
+                                if (!listRecipents.contains(address.trim())) {
+                                    // [CONTINUUM-2281] Dont repeat addesss in recipents.
+                                    // TODO: set a proper name
+                                    InternetAddress to = new InternetAddress(address.trim());
+
+                                    log.info("Recipient: To '" + to + "'.");
+                                    message.addRecipient(Message.RecipientType.TO, to);
+                                    listRecipents.add(address.trim());
+                                }
                             }
 
                         }
@@ -737,7 +744,7 @@
                                     for ( ChangeSet changeSet : changes )
                                     {
                                         String scmId = changeSet.getAuthor();
-                                        if ( StringUtils.isNotEmpty( scmId ) )
+                                        if (StringUtils.isNotEmpty(scmId))
                                         {
                                             String email = developerToEmailMap.get( scmId
);
                                             if ( StringUtils.isEmpty( email ) )
@@ -747,13 +754,15 @@
                                                     "no email address is defined in developers
list for '" + scmId +
                                                         "' scm id." );
                                             }
-                                            else
-                                            {
+                                            else if (!listRecipents.contains(email.trim()))
+                                            {  
+                                                // [CONTINUUM-2281] Dont repeat addesss in
recipents.)
                                                 // TODO: set a proper name
                                                 InternetAddress to = new InternetAddress(
email.trim() );
                                                 log.info( "Recipient: To '" + to + "'." );
 
                                                 message.addRecipient( Message.RecipientType.TO,
to );
+                                                listRecipents.add(email.trim());
                                             }
                                         }
                                     }



Mime
View raw message