continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r802674 - /continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/manager/DefaultBuildAgentTaskQueueManager.java
Date Mon, 10 Aug 2009 07:28:46 GMT
Author: ctan
Date: Mon Aug 10 07:28:46 2009
New Revision: 802674

URL: http://svn.apache.org/viewvc?rev=802674&view=rev
Log:
[CONTINUUM-2320] prevent NPE in build agent task queue manager
merge -r 802672:802673 from 1.3.x branch

Modified:
    continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/manager/DefaultBuildAgentTaskQueueManager.java

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/manager/DefaultBuildAgentTaskQueueManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/manager/DefaultBuildAgentTaskQueueManager.java?rev=802674&r1=802673&r2=802674&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/manager/DefaultBuildAgentTaskQueueManager.java
(original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/manager/DefaultBuildAgentTaskQueueManager.java
Mon Aug 10 07:28:46 2009
@@ -117,8 +117,11 @@
             {
                 for ( BuildProjectTask task : queues )
                 {
-                    log.info( "remove project '" + task.getProjectName() + "' from build
queue" );
-                    buildAgentBuildQueue.remove( task );
+                    if ( task != null )
+                    {
+                        log.info( "remove project '" + task.getProjectName() + "' from build
queue" );
+                        buildAgentBuildQueue.remove( task );
+                    }
                 }
             }
             else
@@ -186,7 +189,7 @@
             {
                 for ( BuildProjectTask task : queues )
                 {
-                    if ( task.getProjectId() == projectId )
+                    if ( task != null && task.getProjectId() == projectId )
                     {
                         log.info( "project already in build queue" );
                         return true;
@@ -217,8 +220,9 @@
             {
                 for ( PrepareBuildProjectsTask task : queues )
                 {
-                	if ( task.getProjectGroupId() == projectGroupId && task.getBuildTrigger().getTrigger()
== buildTrigger.getTrigger() &&
-                        task.getScmRootAddress().equals( scmRootAddress ) )
+                	if ( task != null && task.getProjectGroupId() == projectGroupId
&& 
+                             task.getBuildTrigger().getTrigger() == buildTrigger.getTrigger()
&&
+                             task.getScmRootAddress().equals( scmRootAddress ) )
                     {
                         log.info( "projects already in build queue" );
                         return true;
@@ -300,7 +304,7 @@
         {
             for ( PrepareBuildProjectsTask task : tasks )
             {
-                if ( task.getProjectGroupId() == projectGroupId && task.getScmRootId()
== scmRootId )
+                if ( task != null && task.getProjectGroupId() == projectGroupId &&
task.getScmRootId() == scmRootId )
                 {
                     return getPrepareBuildQueue().remove( task );
                 }
@@ -319,7 +323,7 @@
         {
             for ( PrepareBuildProjectsTask task : tasks )
             {
-                if ( ArrayUtils.contains( hashCodes, task.getHashCode() ) )
+                if ( task != null && ArrayUtils.contains( hashCodes, task.getHashCode()
) )
                 {
                     getPrepareBuildQueue().remove( task );
                 }
@@ -336,7 +340,7 @@
         {
             for ( BuildProjectTask task : tasks )
             {
-                if ( task.getProjectId() == projectId && task.getBuildDefinitionId()
== buildDefinitionId )
+                if ( task != null && task.getProjectId() == projectId &&
task.getBuildDefinitionId() == buildDefinitionId )
                 {
                     return getBuildQueue().remove( task );
                 }
@@ -355,7 +359,7 @@
         {
             for ( BuildProjectTask task : tasks )
             {
-                if ( ArrayUtils.contains( hashCodes, task.getHashCode() ) )
+                if ( task != null && ArrayUtils.contains( hashCodes, task.getHashCode()
) )
                 {
                     getBuildQueue().remove( task );
                 }



Mime
View raw message