incubator-easyant-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kpsiddha...@apache.org
Subject svn commit: r1091668 - /incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/MetaBuildExecutor.java
Date Wed, 13 Apr 2011 06:32:11 GMT
Author: kpsiddharth
Date: Wed Apr 13 06:32:11 2011
New Revision: 1091668

URL: http://svn.apache.org/viewvc?rev=1091668&view=rev
Log:
EEASYANT-9: Defensive check to prevent a NPE

Modified:
    incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/MetaBuildExecutor.java

Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/MetaBuildExecutor.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/MetaBuildExecutor.java?rev=1091668&r1=1091667&r2=1091668&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/MetaBuildExecutor.java
(original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/MetaBuildExecutor.java
Wed Apr 13 06:32:11 2011
@@ -54,7 +54,7 @@ import org.apache.tools.ant.util.StringU
 public class MetaBuildExecutor extends DefaultExecutor {
 
     private static final String DEMARKER = "======================================================================";
-    
+
     @Override
     public void executeTargets(Project project, String[] targets)
             throws BuildException {
@@ -202,14 +202,17 @@ public class MetaBuildExecutor extends D
     private void printExecutionSubBuildsExecutionTimes(Project project) {
         List<ExecutionResult> allSubBuildResults = (List<ExecutionResult>) project
                 .getReference(SubBuildExecutionTimer.EXECUTION_TIMER_SUBBUILD_RESULTS);
-        StringBuilder sb = new StringBuilder();
-        sb.append(StringUtils.LINE_SEP).append(DEMARKER).append(
-                StringUtils.LINE_SEP);
-        sb.append("Project Sub-modules Summary: ").append(StringUtils.LINE_SEP).append(
-                DEMARKER);
-        sb.append(StringUtils.LINE_SEP).append(
-                BuildExecutionTimer.formatExecutionResults(allSubBuildResults));
-        sb.append(StringUtils.LINE_SEP).append(DEMARKER);
-        project.log(sb.toString());
+        if (allSubBuildResults != null && allSubBuildResults.size() > 0) {
+            StringBuilder sb = new StringBuilder();
+            sb.append(StringUtils.LINE_SEP).append(DEMARKER).append(
+                    StringUtils.LINE_SEP);
+            sb.append("Project Sub-modules Summary: ").append(
+                    StringUtils.LINE_SEP).append(DEMARKER);
+            sb.append(StringUtils.LINE_SEP).append(
+                    BuildExecutionTimer
+                            .formatExecutionResults(allSubBuildResults));
+            sb.append(StringUtils.LINE_SEP).append(DEMARKER);
+            project.log(sb.toString());
+        }
     }
 }



Mime
View raw message