continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From batkin...@apache.org
Subject svn commit: r1662737 - /continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Date Fri, 27 Feb 2015 16:26:54 GMT
Author: batkinson
Date: Fri Feb 27 16:26:54 2015
New Revision: 1662737

URL: http://svn.apache.org/r1662737
Log:
Preventing removal of pending agent build results.

Modified:
    continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=1662737&r1=1662736&r2=1662737&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Fri Feb 27 16:26:54 2015
@@ -110,16 +110,7 @@ import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
+import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -1048,9 +1039,30 @@ public class DefaultContinuum
                 parallelBuildsManager.isProjectInAnyCurrentBuild( project.getId() ) )
             {
                 throw new ContinuumException(
-                    "Unable to remove build result because it is currently being used by"
+ "a building project " +
+                    "Unable to remove build result because it is currently being used by
a building project " +
                         project.getId() );
             }
+
+            int projectId = buildResult.getProject().getId();
+            int buildDefId = buildResult.getBuildDefinition().getId();
+            boolean resultPending = false;
+
+            try
+            {
+                resultPending =
+                    distributedBuildManager.getCurrentRun( projectId, buildDefId ).getBuildResultId()
== buildId;
+            }
+            catch ( ContinuumException e )
+            {
+                // No current run for given project/builddef
+            }
+
+            if ( resultPending )
+            {
+                throw new ContinuumException(
+                    String.format( "Unable to remove build result %s, response is pending
from build agent %s.",
+                                   buildId, buildResult.getBuildUrl() ) );
+            }
         }
         catch ( BuildManagerException e )
         {



Mime
View raw message