ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r540044 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Retry.java
Date Mon, 21 May 2007 07:12:00 GMT
Author: jhm
Date: Mon May 21 00:11:59 2007
New Revision: 540044

URL: http://svn.apache.org/viewvc?view=rev&rev=540044
Log:
<retry>: Collect former error messages and re-throw them.

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Retry.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Retry.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Retry.java?view=diff&rev=540044&r1=540043&r2=540044
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Retry.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Retry.java Mon May 21 00:11:59 2007
@@ -56,6 +56,7 @@
      * perform the work
      */
     public void execute() throws BuildException {
+        StringBuffer errorMessages = new StringBuffer();
         for(int i=0; i<=retryCount; i++) {
             try {
                 nestedTask.perform();
@@ -63,8 +64,18 @@
             } catch (Exception e) {
                 if (i<retryCount) {
                     log("Attempt ["+i+"] error occured, retrying...", e, Project.MSG_INFO);
+                    errorMessages.append(e.getMessage());
+                    errorMessages.append(getProject().getProperty("line.separator"));
                 } else {
-                    throw new BuildException("Task ["+nestedTask.getTaskName()+"] failed
after ["+retryCount+"] attempts, giving up");
+                    errorMessages.append(e.getMessage());
+                    StringBuffer exceptionMessage = new StringBuffer();
+                    exceptionMessage.append("Task [").append(nestedTask.getTaskName());
+                    exceptionMessage.append("] failed after [").append(retryCount);
+                    exceptionMessage.append("] attempts, giving up.");
+                    exceptionMessage.append(getProject().getProperty("line.separator"));
+                    exceptionMessage.append("Error messages:").append(getProject().getProperty("line.separator"));
+                    exceptionMessage.append(errorMessages);
+                    throw new BuildException(exceptionMessage.toString(), getLocation());
                 }
             }
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message