You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Dmitri G. Chtchekine" <dg...@emory.edu> on 2001/12/11 23:56:38 UTC

DELETE exception

 I get exception trying to delete some files (OS is Windows NT).
 Strangely some files get deleted, and on some ant failes.
 All files have same permissions.
 Here is the code:
   <delete file="${build.dir}\${package.root.dcmtools}\Certifier.ini"/>
   <delete file="${build.dir}\${package.root.dcmtools}\BulkLoad.ini"/>
   <delete file="${build.dir}\${package.root.dcmtools}\MainMenu.ini"/>
   <delete file="${build.dir}\${package.root.dcmtools}\ProductDelete.ini"/>
   <delete file="${build.dir}\${package.root.dcmtools}\Reports.ini"/>
 
 Here is output:
 
 [delete] Deleting:
 C:\java\buildclasses\dcmtools\Certifier.ini
    [delete] Deleting:
 C:\java\buildclasses\dcmtools\BulkLoad.ini
    [delete] Deleting:
 C:\java\buildclasses\dcmtools\MainMenu.ini
    [delete] Deleting:
 C:\java\buildclasses\dcmtools\ProductDelete.ini
 
 BUILD FAILED
 
 d:\ant\buildpii.xml:726: Unable to delete file
 C:\java\buildclasses\dcmtools\ProductDelete.ini
         at org.apache.tools.ant.taskdefs.Delete.execute(Delete.java:267)
         at org.apache.tools.ant.Task.perform(Task.java:217)
         at org.apache.tools.ant.Target.execute(Target.java:164)
         at org.apache.tools.ant.Target.performTasks(Target.java:182)
         at org.apache.tools.ant.Project.executeTarget(Project.java:601)
         at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:256)
         at
 org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:120)
         at org.apache.tools.ant.Task.perform(Task.java:217)
         at org.apache.tools.ant.Target.execute(Target.java:164)
         at org.apache.tools.ant.Target.performTasks(Target.java:182)
         at org.apache.tools.ant.Project.executeTarget(Project.java:601)
         at org.apache.tools.ant.Project.executeTargets(Project.java:560)
         at org.apache.tools.ant.Main.runBuild(Main.java:454)
         at org.apache.tools.ant.Main.start(Main.java:153)
         at org.apache.tools.ant.Main.main(Main.java:176)
 
 
 TIA!


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: DELETE exception

Posted by Scott Ellsworth <sc...@alodar.com>.
At 6:42 PM -0500 12/11/01, Magesh Umasankar wrote:
>From: "Dmitri G. Chtchekine" <dg...@emory.edu>
>
>>  I get exception trying to delete some files (OS is Windows NT).
>
>Windows doesn't let a program delete any file that is "locked"
>by the OS at the time of attempting to delete.  Such is not the case
>in Unix.  So this problem will usually occur in Windows only.

Not entirely true!  It turns out that many NFS implementations also 
die if you attempt to manipulate a file which is still open.  Some of 
them even let the call finish, write a temp file to the disk with an 
enlightening name like .nfs872987410938741097341, then block on the 
NEXT read attempt!

Scott
-- 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: DELETE exception

Posted by "Dmitri G. Chtchekine" <dg...@emory.edu>.
It's not Windows' locking. (I have seen Windows locking
when I had Explorer open and tried to delete some directories)

What I found is that DELETE fails b/c it's proceded by a 
PropertyFile task AND a Copy task. Here is the code:
 <copy todir="${build.dir}\${package.root.dcmtools}">
	<fileset dir="${src.dir}\${package.root.dcmtools}">
    		<include name="*.ini"/>
    	</fileset> 
 </copy>

<!-- Set BulkLoad.ini values -->
<propertyfile file="${build.dir}\${package.root.dcmtools}\BulkLoad.ini" 
	comment="Customized for ${build.type} environment on">
    <entry key="HOST_DIR" value="${host.dir.bulkload}"/>
</propertyfile>

<delete file="${build.dir}\${package.root.dcmtools}\BulkLoad.ini"/>

Output is:
     [copy] BulkLoad.ini omitted as
C:\java\buildclasses\dcmtools\BulkLoad.ini is up to date.
     [copy] Certifier.ini omitted as
C:\java\buildclasses\dcmtools\Certifier.ini is up to date.
     [copy] MainMenu.ini omitted as
C:\java\buildclasses\dcmtools\MainMenu.ini is up to date.
     [copy] ProductDelete.ini omitted as
C:\java\buildclasses\dcmtools\ProductDelete.ini is up to date.
     [copy] Reports.ini omitted as
C:\java\buildclasses\dcmtools\Reports.ini is up to date.
[propertyfile] Updating property file:
C:\java\buildclasses\dcmtools\BulkLoad.ini
   [delete] Deleting:
C:\java\buildclasses\dcmtools\BulkLoad.ini

BUILD FAILED

d:\ant\buildpii.xml:724: Unable to delete file
C:\java\buildclasses\dcmtools\BulkLoad.ini
        at org.apache.tools.ant.taskdefs.Delete.execute(Delete.java:267)
        at org.apache.tools.ant.Task.perform(Task.java:217)
        at org.apache.tools.ant.Target.execute(Target.java:164)
        at org.apache.tools.ant.Target.performTasks(Target.java:182)
        at org.apache.tools.ant.Project.executeTarget(Project.java:601)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:256)
        at
org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:120)
        at org.apache.tools.ant.Task.perform(Task.java:217)
        at org.apache.tools.ant.Target.execute(Target.java:164)
        at org.apache.tools.ant.Target.performTasks(Target.java:182)
        at org.apache.tools.ant.Project.executeTarget(Project.java:601)
        at org.apache.tools.ant.Project.executeTargets(Project.java:560)
        at org.apache.tools.ant.Main.runBuild(Main.java:454)
        at org.apache.tools.ant.Main.start(Main.java:153)
        at org.apache.tools.ant.Main.main(Main.java:176)

When I did several PropertyFile tasks on different files and tried to
delete all of them write after, the DELETE always failed on the file
which properties were modified last. E.g. in:

<propertyfile file="A"/>
<propertyfile file="B"/>
<delete file="A"/>
<delete file="B"/>

DELETE on B will fail.

Also if I remove either PropertyFile or Copy task everything is OK.
Also if I replace Copy with FileSet to simple Copy file it also
works.

Also note that if there are multiple files like in the above example
all get deleted and it fails on the last one.

?????

 
On Tue, 11 Dec 2001, Magesh Umasankar wrote:

> From: "Dmitri G. Chtchekine" <dg...@emory.edu>
> 
> > I get exception trying to delete some files (OS is Windows NT).
> 
> Windows doesn't let a program delete any file that is "locked"
> by the OS at the time of attempting to delete.  Such is not the case
> in Unix.  So this problem will usually occur in Windows only.
> 
> >  Strangely some files get deleted, and on some ant failes.
> 
> Delete will fail only if some other task already holds an
> open handle to the file that you attempt to delete.  So, 
> please look at which task uses this file in the build
> before a delete attempt on it is made.  If it is a built-in
> task that doesn't close the file before you try to delete it,
> please let me know.  If it is some custom task that
> uses this file, you need to look into whether the file closes
> all Input/Output Streams that the task holds on the file.
> 
> Magesh
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: DELETE exception

Posted by Magesh Umasankar <um...@apache.org>.
From: "Dmitri G. Chtchekine" <dg...@emory.edu>

> I get exception trying to delete some files (OS is Windows NT).

Windows doesn't let a program delete any file that is "locked"
by the OS at the time of attempting to delete.  Such is not the case
in Unix.  So this problem will usually occur in Windows only.

>  Strangely some files get deleted, and on some ant failes.

Delete will fail only if some other task already holds an
open handle to the file that you attempt to delete.  So, 
please look at which task uses this file in the build
before a delete attempt on it is made.  If it is a built-in
task that doesn't close the file before you try to delete it,
please let me know.  If it is some custom task that
uses this file, you need to look into whether the file closes
all Input/Output Streams that the task holds on the file.

Magesh




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: DELETE exception

Posted by Peter Donald <pe...@apache.org>.
It is likely that windows is locking the file because you have it open in an 
editor or some other application has it opened.

On Wed, 12 Dec 2001 09:56, Dmitri G. Chtchekine wrote:
>  I get exception trying to delete some files (OS is Windows NT).
>  Strangely some files get deleted, and on some ant failes.
>  All files have same permissions.
>  Here is the code:
>    <delete file="${build.dir}\${package.root.dcmtools}\Certifier.ini"/>
>    <delete file="${build.dir}\${package.root.dcmtools}\BulkLoad.ini"/>
>    <delete file="${build.dir}\${package.root.dcmtools}\MainMenu.ini"/>
>    <delete file="${build.dir}\${package.root.dcmtools}\ProductDelete.ini"/>
>    <delete file="${build.dir}\${package.root.dcmtools}\Reports.ini"/>
>
>  Here is output:
>
>  [delete] Deleting:
>  C:\java\buildclasses\dcmtools\Certifier.ini
>     [delete] Deleting:
>  C:\java\buildclasses\dcmtools\BulkLoad.ini
>     [delete] Deleting:
>  C:\java\buildclasses\dcmtools\MainMenu.ini
>     [delete] Deleting:
>  C:\java\buildclasses\dcmtools\ProductDelete.ini
>
>  BUILD FAILED
>
>  d:\ant\buildpii.xml:726: Unable to delete file
>  C:\java\buildclasses\dcmtools\ProductDelete.ini
>          at org.apache.tools.ant.taskdefs.Delete.execute(Delete.java:267)
>          at org.apache.tools.ant.Task.perform(Task.java:217)
>          at org.apache.tools.ant.Target.execute(Target.java:164)
>          at org.apache.tools.ant.Target.performTasks(Target.java:182)
>          at org.apache.tools.ant.Project.executeTarget(Project.java:601)
>          at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:256)
>          at
>  org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:120)
>          at org.apache.tools.ant.Task.perform(Task.java:217)
>          at org.apache.tools.ant.Target.execute(Target.java:164)
>          at org.apache.tools.ant.Target.performTasks(Target.java:182)
>          at org.apache.tools.ant.Project.executeTarget(Project.java:601)
>          at org.apache.tools.ant.Project.executeTargets(Project.java:560)
>          at org.apache.tools.ant.Main.runBuild(Main.java:454)
>          at org.apache.tools.ant.Main.start(Main.java:153)
>          at org.apache.tools.ant.Main.main(Main.java:176)
>
>
>  TIA!

-- 
Cheers,

Pete

-----------------------------------------------------------
 "Remember, your body is a temple; however, it's also your 
 dancehall and bowling alley"   -- Dharma Montgomery
-----------------------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: DELETE exception

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
Usually this means another process has a lock on the file. Check for
programs, even editors, that have accessed this file.

Conor


> -----Original Message-----
> From: Dmitri G. Chtchekine [mailto:dgchtch@emory.edu]
> Sent: Wednesday, 12 December 2001 9:57 AM
> To: Ant Users List
> Subject: DELETE exception
>
>
>  I get exception trying to delete some files (OS is Windows NT).
>  Strangely some files get deleted, and on some ant failes.
>  All files have same permissions.
>  Here is the code:
>    <delete file="${build.dir}\${package.root.dcmtools}\Certifier.ini"/>
>    <delete file="${build.dir}\${package.root.dcmtools}\BulkLoad.ini"/>
>    <delete file="${build.dir}\${package.root.dcmtools}\MainMenu.ini"/>
>    <delete
> file="${build.dir}\${package.root.dcmtools}\ProductDelete.ini"/>
>    <delete file="${build.dir}\${package.root.dcmtools}\Reports.ini"/>
>
>  Here is output:
>
>  [delete] Deleting:
>  C:\java\buildclasses\dcmtools\Certifier.ini
>     [delete] Deleting:
>  C:\java\buildclasses\dcmtools\BulkLoad.ini
>     [delete] Deleting:
>  C:\java\buildclasses\dcmtools\MainMenu.ini
>     [delete] Deleting:
>  C:\java\buildclasses\dcmtools\ProductDelete.ini
>
>  BUILD FAILED
>
>  d:\ant\buildpii.xml:726: Unable to delete file
>  C:\java\buildclasses\dcmtools\ProductDelete.ini
>          at org.apache.tools.ant.taskdefs.Delete.execute(Delete.java:267)
>          at org.apache.tools.ant.Task.perform(Task.java:217)
>          at org.apache.tools.ant.Target.execute(Target.java:164)
>          at org.apache.tools.ant.Target.performTasks(Target.java:182)
>          at org.apache.tools.ant.Project.executeTarget(Project.java:601)
>          at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:256)
>          at
>  org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:120)
>          at org.apache.tools.ant.Task.perform(Task.java:217)
>          at org.apache.tools.ant.Target.execute(Target.java:164)
>          at org.apache.tools.ant.Target.performTasks(Target.java:182)
>          at org.apache.tools.ant.Project.executeTarget(Project.java:601)
>          at org.apache.tools.ant.Project.executeTargets(Project.java:560)
>          at org.apache.tools.ant.Main.runBuild(Main.java:454)
>          at org.apache.tools.ant.Main.start(Main.java:153)
>          at org.apache.tools.ant.Main.main(Main.java:176)
>
>
>  TIA!
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>