ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: Retry task available in svn head
Date Mon, 21 May 2007 07:14:47 GMT
committed

Jan 

>-----Urspr√ľngliche Nachricht-----
>Von: Kevin Jackson [mailto:foamdino@gmail.com] 
>Gesendet: Montag, 21. Mai 2007 08:40
>An: Ant Developers List
>Betreff: Re: Retry task available in svn head
>
>Hi Jan,
>
>> Would this be more useful?
>>
>>     public void execute() throws BuildException {
>>         StringBuffer errorMessages = new StringBuffer();
>>         for(int i=0; i<=retryCount; i++) {
>>             try {
>>                 nestedTask.perform();
>>                 break;
>>             } 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 {
>>                     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());
>>                 }
>>             }
>>         }
>>     }
>>
>>
>>   <target name="test-fail-and-retry">
>>     <property name="i" value="3"/>
>>     <property name="dest" value="${java.io.tmpdir}/dest"/>
>>     <!-- just in case this ever becomes a legit url... -->
>>     <property name="src" value="http://iojasodjojaosdj"/>
>>       <retry retrycount="${i}">
>>         <get src="${src}" dest="${dest}"/>
>>       </retry>
>>   </target>
>>
>>
>> test-fail-and-retry:
>>       [get] Getting: http://iojasodjojaosdj
>>       [get] To: c:\temp\dest
>>       [get] Error getting http://iojasodjojaosdj to c:\temp\dest
>>     [retry] Attempt [0] error occured, retrying...
>>       [get] Getting: http://iojasodjojaosdj
>>       [get] To: c:\temp\dest
>>       [get] Error getting http://iojasodjojaosdj to c:\temp\dest
>>     [retry] Attempt [1] error occured, retrying...
>>       [get] Getting: http://iojasodjojaosdj
>>       [get] To: c:\temp\dest
>>       [get] Error getting http://iojasodjojaosdj to c:\temp\dest
>>     [retry] Attempt [2] error occured, retrying...
>>       [get] Getting: http://iojasodjojaosdj
>>       [get] To: c:\temp\dest
>>       [get] Error getting http://iojasodjojaosdj to c:\temp\dest
>>
>> BUILD FAILED
>> C:\TEMP\retry-test.xml:9: Task [get] failed after [3] 
>attempts, giving
>> up.
>> Error messages:
>> java.net.UnknownHostException: iojasodjojaosdj
>> java.net.UnknownHostException: iojasodjojaosdj
>> java.net.UnknownHostException: iojasodjojaosdj
>> java.net.UnknownHostException: iojasodjojaosdj
>
>Yes the output here looks more informative than before.  My +1 for
>moving to your style of output
>
>Kev
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
>For additional commands, e-mail: dev-help@ant.apache.org
>
>

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


Mime
View raw message