continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r233321 - in /maven/continuum/trunk: continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/ continuum-notifiers/continuum-notifier-irc/src/main/java/org/apache/maven/continuum/notification/irc/
Date Thu, 18 Aug 2005 14:40:34 GMT
Author: brett
Date: Thu Aug 18 07:40:26 2005
New Revision: 233321

URL: http://svn.apache.org/viewcvs?rev=233321&view=rev
Log:
correct ordering of build list

Modified:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java
    maven/continuum/trunk/continuum-notifiers/continuum-notifier-irc/src/main/java/org/apache/maven/continuum/notification/irc/IrcContinuumNotifier.java

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java?rev=233321&r1=233320&r2=233321&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java
Thu Aug 18 07:40:26 2005
@@ -39,8 +39,8 @@
 import java.io.StringWriter;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
-import java.util.Collection;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
@@ -439,15 +439,14 @@
         {
             throw new ContinuumException( "Unable to obtain project builds", e );
         }
-        Collection builds = project.getBuildResults();
+        List builds = project.getBuildResults();
 
-        if ( builds.size() == 0 )
+        if ( builds.size() < 2 )
         {
             return null;
         }
 
-        Iterator itr = builds.iterator();
-        BuildResult build = (BuildResult) itr.next();
+        BuildResult build = (BuildResult) builds.get( builds.size() - 1 );
 
         if ( currentBuild != null && build.getId() != currentBuild.getId() )
         {
@@ -455,12 +454,7 @@
                 "Current build: '" + currentBuild.getId() + "', " + "first build: '" + build.getId()
+ "'." );
         }
 
-        if ( !itr.hasNext() )
-        {
-            return null;
-        }
-
-        return (BuildResult) itr.next();
+        return (BuildResult) builds.get( builds.size() - 2 );
     }
 
     /**

Modified: maven/continuum/trunk/continuum-notifiers/continuum-notifier-irc/src/main/java/org/apache/maven/continuum/notification/irc/IrcContinuumNotifier.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-notifiers/continuum-notifier-irc/src/main/java/org/apache/maven/continuum/notification/irc/IrcContinuumNotifier.java?rev=233321&r1=233320&r2=233321&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-notifiers/continuum-notifier-irc/src/main/java/org/apache/maven/continuum/notification/irc/IrcContinuumNotifier.java
(original)
+++ maven/continuum/trunk/continuum-notifiers/continuum-notifier-irc/src/main/java/org/apache/maven/continuum/notification/irc/IrcContinuumNotifier.java
Thu Aug 18 07:40:26 2005
@@ -28,8 +28,7 @@
 import org.codehaus.plexus.ircbot.IrcBot;
 import org.codehaus.plexus.notification.NotificationException;
 
-import java.util.Collection;
-import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
@@ -234,15 +233,15 @@
         {
             throw new ContinuumException( "Unable to obtain project builds", e );
         }
-        Collection builds = project.getBuildResults();
 
-        if ( builds.size() == 0 )
+        List builds = project.getBuildResults();
+
+        if ( builds.size() < 2 )
         {
             return null;
         }
 
-        Iterator itr = builds.iterator();
-        BuildResult build = (BuildResult) itr.next();
+        BuildResult build = (BuildResult) builds.get( builds.size() - 1 );
 
         if ( currentBuild != null && build.getId() != currentBuild.getId() )
         {
@@ -250,12 +249,7 @@
                 "Current build: '" + currentBuild.getId() + "', " + "first build: '" + build.getId()
+ "'." );
         }
 
-        if ( !itr.hasNext() )
-        {
-            return null;
-        }
-
-        return (BuildResult) itr.next();
+        return (BuildResult) builds.get( builds.size() - 2 );
     }
 
     /**



Mime
View raw message