You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by "NIkhil R. Deshpande" <ni...@flashmail.com> on 2000/12/13 13:05:38 UTC

[BUG] NullPointerException while Deleting a directory.

I apologize if this has been already reported. But could
not find anything on this when searched the bug report
database.
Tried to submit this bug through BugRat, but when I tried
to view this report online, the text for 'How to reproduce'
was missing. So mailing this to ant-dev.

With regards,
 Nikhil

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

Report ID = 587 
class: swbug
Project release: Ant 1.2
JVM Release: Sun JDK1.1.8
OS: Solaris
OS Release: 2.7
Platform: Sparc

Report Synopsis:
----------------
NullPointerException while Deleting a directory.

Report Description:
------------------

On an Unix platform,
When the directory cannot be deleted by the delete task,
ant throws a NullPointerException (for a particular case):

Stack trace:
------------
nikhild@localhost:~/src/TEST>ant clean
Searching for build.xml ...
Buildfile: /home/nikhild/src/TEST/build.xml

clean:
   [delete] Deleting directory /home/nikhild/src/TEST/lib/classes

BUILD FAILED

java.lang.NullPointerException
        at org.apache.tools.ant.taskdefs.Delete.removeDir(Compiled Code)
        at org.apache.tools.ant.taskdefs.Delete.execute(Compiled Code)
        at org.apache.tools.ant.Target.execute(Compiled Code)
        at org.apache.tools.ant.Project.runTarget(Compiled Code)
        at org.apache.tools.ant.Project.executeTarget(Compiled Code)
        at org.apache.tools.ant.Project.executeTargets(Compiled Code)
        at org.apache.tools.ant.Main.runBuild(Compiled Code)
        at org.apache.tools.ant.Main.main(Compiled Code)

Total time: 0 seconds
nikhild@localhost:~/src/TEST>


How To Reproduce:
-----------------
Stumbled upon this when did a build by root user and then
clean by a non-root user.

Lets take the ${build.classes} directory as the guinea pig.
1. Create the ${build.classes} directory by hand
   say mkdir lib/classes (if not already exits).

2. Change it's access permissions to 000
   say chmod 000 lib/classes/
   (Or change the owner of the directory say to root)

3. Now run ant clean (assuming the clean target has a task
   to delete ${build.classes}

And this results in a NullPointerException.