Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 43777 invoked from network); 21 May 2007 06:40:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 May 2007 06:40:44 -0000 Received: (qmail 31479 invoked by uid 500); 21 May 2007 06:40:49 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 31437 invoked by uid 500); 21 May 2007 06:40:49 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 31423 invoked by uid 99); 21 May 2007 06:40:49 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 May 2007 23:40:49 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of foamdino@gmail.com designates 209.85.134.191 as permitted sender) Received: from [209.85.134.191] (HELO mu-out-0910.google.com) (209.85.134.191) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 May 2007 23:40:42 -0700 Received: by mu-out-0910.google.com with SMTP id g7so1022848muf for ; Sun, 20 May 2007 23:40:21 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=uIE7Gl2DWmRJ8usShFYteYUVMl8GdKLCi9fobHOOW7WTVYb8Uczddww+a1oJeOjkUZ8RueE785fya2qhhbVQDrbGa0EJ320u2QbJn2CwIKkqyNcNxFg2O9kl3BGHKpenuvS6jgFpLF6pE3bZpiMzutNdzGuwYvHWJQZ9wVp5B2w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=rMQJC4m95kAjY1ow3MHhNlXJ4PTRaEnGEI7quJ7RfDEbDpD7CnI7udGpSqTE45D4Ek0x6a+aBQZON3rz3IvHxHbE1M3wWJEkBUjef5H5/jQu0KveLiLX/ygiiuTLKa20k9vHblHwpeKqC7eYaLVjuBX6+PuxWxEElC40+NUD8xA= Received: by 10.82.189.6 with SMTP id m6mr7978341buf.1179729621380; Sun, 20 May 2007 23:40:21 -0700 (PDT) Received: by 10.82.151.12 with HTTP; Sun, 20 May 2007 23:40:21 -0700 (PDT) Message-ID: Date: Mon, 21 May 2007 13:40:21 +0700 From: "Kevin Jackson" To: "Ant Developers List" Subject: Re: Retry task available in svn head In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Virus-Checked: Checked by ClamAV on apache.org 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 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()); > } > } > } > } > > > > > > > > > > > > > > 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