diff --git a/WHATSNEW b/WHATSNEW index 3cc065876..210efd83f 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -356,6 +356,10 @@ Fixed bugs: when writing zips or jars. Bugzilla Report 45548 + * could into a NullPointerException when faced with broken + symbolic links. + Bugzilla Report 46747. + Other changes: -------------- * A HostInfo task was added performing information on hosts, including info on diff --git a/src/main/org/apache/tools/ant/taskdefs/Sync.java b/src/main/org/apache/tools/ant/taskdefs/Sync.java index 0aa9df11e..7111dd622 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Sync.java +++ b/src/main/org/apache/tools/ant/taskdefs/Sync.java @@ -235,7 +235,8 @@ public class Sync extends Task { // delete them. for (int i = dirs.length - 1; i >= 0; --i) { File f = new File(toDir, dirs[i]); - if (f.list().length < 1) { + String[] children = f.list(); + if (children == null || children.length < 1) { log("Removing orphan directory: " + f, Project.MSG_DEBUG); f.delete(); ++removedCount[0];