ant-dev mailing list archives

Site index · List index
Message view
Top
From GBartl...@harland.net
Subject Suggested change to Move.java to check failonerror flag when unable to delete source file as part of move
Date Mon, 11 Apr 2005 18:22:30 GMT
A couple of weeks back I sent the following to the ant user list without
any response.  I am thinking that the dev list would have been a better
place for this request.  Can someone here give this a read and let me know
if this change can be accepted back into the ant source.

Thanks,

Gary Bartlett

Greetings

I have some ant scripts that manage archiving files between NT servers in
our production environment.  A while back the move task began failing with
an error related to deleting the source file (see below)

[move] Warning: Unable to delete file \\server\foo\bar.log

Under ant 162 when this happens the move task stops processing the list of
files to move  - but the ant script does not fail.

I have the move task configured with failonerror=false - but looking at the
code it seems that this parameter is not honored by the move class.   I
made a couple of changes locally to have the move class check this flag and
conditionally issue a warning as opposed to an abort - and was wondering if
these changes could get committed into the base code.

Here are the changes:

Move.java

193,194c244
<              boolean failOnError = getFailOnError();
<                String message = "Unable to delete "
---
>                 throw new BuildException("Unable to delete "
196,202c246
<                                         + fromFile.getAbsolutePath()
<                                       + " FailOnError is "+failOnError;
<               if (failOnError) {
<                       throw new BuildException(message);
<               } else {
<                         log(message);
<               }
---
>                                         + fromFile.getAbsolutePath());

Copy.java  (added accessor to the failonerror flag)

269,271d267
<     public boolean getFailOnError() {
<         return failonerror;
<     }

--------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org