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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
