https://issues.apache.org/bugzilla/show_bug.cgi?id=46747
Summary: sync task crashes with NPE when trying to delete dead
directory symlink
Product: Ant
Version: 1.7.1
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Core tasks
AssignedTo: [email protected]
ReportedBy: [email protected]
I've only tested this on Linux, I assume it is the same on all Unix-like
operating systems that support symlinks. Suppose you have in a directory a
subdirectory and a symbolic link to it. Then you try, via ant, to sync another
directory to it that contains neither. The sync task will try to delete both,
and will fail.
To set up a test case, do:
mkdir t s t/n
ln -s n t/m
and then execute the following ant target:
<target name="synchro">
<sync todir="t">
<fileset dir="s">
<include name="**/*" />
</fileset>
</sync>
</target>
What will happen is this:
Buildfile: build.xml
synchro:
BUILD FAILED
java.lang.NullPointerException
at org.apache.tools.ant.taskdefs.Sync.removeOrphanFiles(Sync.java:218)
at org.apache.tools.ant.taskdefs.Sync.execute(Sync.java:118)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Total time: 0 seconds
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.