You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ct...@apache.org on 2009/04/17 15:08:50 UTC

svn commit: r765980 - /continuum/branches/continuum-1.3.x/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/AbstractBuildExecutor.java

Author: ctan
Date: Fri Apr 17 13:08:50 2009
New Revision: 765980

URL: http://svn.apache.org/viewvc?rev=765980&view=rev
Log:
[CONTINUUM-2179] prevent NPE when updating project from working copy on build agents

Modified:
    continuum/branches/continuum-1.3.x/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/AbstractBuildExecutor.java

Modified: continuum/branches/continuum-1.3.x/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/AbstractBuildExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/AbstractBuildExecutor.java?rev=765980&r1=765979&r2=765980&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/AbstractBuildExecutor.java (original)
+++ continuum/branches/continuum-1.3.x/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/AbstractBuildExecutor.java Fri Apr 17 13:08:50 2009
@@ -320,9 +320,30 @@
         Map<String, Object> projectMap = new HashMap<String, Object>();
 
         projectMap.put( ContinuumBuildAgentUtil.KEY_PROJECT_ID, project.getId() );
-        projectMap.put( ContinuumBuildAgentUtil.KEY_PROJECT_VERSION, project.getVersion() );
-        projectMap.put( ContinuumBuildAgentUtil.KEY_ARTIFACT_ID, project.getArtifactId() );
-        projectMap.put( ContinuumBuildAgentUtil.KEY_GROUP_ID, project.getGroupId() );
+        if ( StringUtils.isNotEmpty( project.getVersion() ) )
+        {
+            projectMap.put( ContinuumBuildAgentUtil.KEY_PROJECT_VERSION, project.getVersion() );
+        }
+        else
+        {
+            projectMap.put( ContinuumBuildAgentUtil.KEY_PROJECT_VERSION, "" );
+        }
+        if ( StringUtils.isNotEmpty( project.getArtifactId() ) )
+        {
+            projectMap.put( ContinuumBuildAgentUtil.KEY_ARTIFACT_ID, project.getArtifactId() );
+        }
+        else
+        {
+            projectMap.put( ContinuumBuildAgentUtil.KEY_ARTIFACT_ID, "" );
+        }
+        if ( StringUtils.isNotEmpty( project.getGroupId() ) )
+        {
+            projectMap.put( ContinuumBuildAgentUtil.KEY_GROUP_ID, project.getGroupId() );
+        }
+        else
+        {
+            projectMap.put( ContinuumBuildAgentUtil.KEY_GROUP_ID, "" );
+        }
         if ( StringUtils.isNotEmpty( project.getName() ) )
         {
             projectMap.put( ContinuumBuildAgentUtil.KEY_PROJECT_NAME, project.getName() );
@@ -390,8 +411,22 @@
             {
                 Map<String, String> map = new HashMap<String, String>();
                 map.put( ContinuumBuildAgentUtil.KEY_PROJECT_DEVELOPER_NAME, developer.getName() );
-                map.put( ContinuumBuildAgentUtil.KEY_PROJECT_DEVELOPER_EMAIL, developer.getEmail() );
-                map.put( ContinuumBuildAgentUtil.KEY_PROJECT_DEVELOPER_SCMID, developer.getScmId() );
+                if ( StringUtils.isNotEmpty( developer.getEmail() ) )
+                {
+                	map.put( ContinuumBuildAgentUtil.KEY_PROJECT_DEVELOPER_EMAIL, developer.getEmail() );
+                }
+                else
+                {
+                	map.put( ContinuumBuildAgentUtil.KEY_PROJECT_DEVELOPER_EMAIL, "" );
+                }
+                if ( StringUtils.isNotEmpty( developer.getScmId() ) )
+                {
+                	map.put( ContinuumBuildAgentUtil.KEY_PROJECT_DEVELOPER_SCMID, developer.getScmId() );
+                }
+                else
+                {
+                    map.put( ContinuumBuildAgentUtil.KEY_PROJECT_DEVELOPER_SCMID, "" );
+                }
 
                 pDevelopers.add( map );
             }
@@ -405,9 +440,30 @@
 
         if ( parent != null )
         {
-            map.put( ContinuumBuildAgentUtil.KEY_GROUP_ID, parent.getGroupId() );
-            map.put( ContinuumBuildAgentUtil.KEY_ARTIFACT_ID, parent.getArtifactId() );
-            map.put( ContinuumBuildAgentUtil.KEY_PROJECT_VERSION, parent.getVersion() );
+            if ( StringUtils.isNotEmpty( parent.getGroupId() ) )
+            {
+                map.put( ContinuumBuildAgentUtil.KEY_GROUP_ID, parent.getGroupId() );
+            }
+            else
+            {
+                map.put( ContinuumBuildAgentUtil.KEY_GROUP_ID, "" );
+            }
+            if ( StringUtils.isNotEmpty( parent.getArtifactId() ) )
+            {
+                map.put( ContinuumBuildAgentUtil.KEY_ARTIFACT_ID, parent.getArtifactId() );
+            }
+            else
+            {
+                map.put( ContinuumBuildAgentUtil.KEY_ARTIFACT_ID, "" );
+            }
+            if ( StringUtils.isNotEmpty( parent.getVersion() ) )
+            {
+                map.put( ContinuumBuildAgentUtil.KEY_PROJECT_VERSION, parent.getVersion() );
+            }
+            else
+            {
+                map.put( ContinuumBuildAgentUtil.KEY_PROJECT_VERSION, "" );
+            }
         }
         return map;
     }
@@ -455,7 +511,7 @@
                 }
                 else
                 {
-
+                    map.put( ContinuumBuildAgentUtil.KEY_NOTIFIER_CONFIGURATION, "" );
                 }
                 if ( StringUtils.isNotBlank( notifier.getType() ) )
                 {