I have just upgraded to ant 1.6.3 while using anthill to build nightly versions of our software. We use clover reporting to help us test and get a code coverage of the tests, but over the past few days i have been getting build failures due to the new version of ant. the problem stems from a java.lang.nullpointerexception error. a full stack trace is below BUILD FAILED C:\Tools\AntHill\AllSDEJ\CuramSDEJ\build_scripts\build.xml:125: The following error occurred while executing t his line: C:\Tools\AntHill\AllSDEJ\CuramSDEJ\build_scripts\build.xml:1140: java.lang.NullPointerException at org.apache.tools.ant.ProjectHelper.addLocationToBuildException (ProjectHelper.java:539) at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:384) at org.apache.tools.ant.taskdefs.CallTarget.execute (CallTarget.java:107) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) at org.apache.tools.ant.Task.perform(Task.java:364) at org.apache.tools.ant.Target.execute(Target.java:341) at org.apache.tools.ant.Target.performTasks(Target.java:369) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) at org.apache.tools.ant.Project.executeTarget(Project.java:1185) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets (DefaultExecutor.java:40) at org.apache.tools.ant.Project.executeTargets(Project.java:1068) at org.apache.tools.ant.Main.runBuild(Main.java:668) at org.apache.tools.ant.Main.startAnt(Main.java:187) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67) Caused by: C:\Tools\AntHill\AllSDEJ\CuramSDEJ\build_scripts\build.xml:1140: java.lang.NullPointerException at org.apache.tools.ant.Task.perform(Task.java:373) at org.apache.tools.ant.Target.execute(Target.java:341) at org.apache.tools.ant.Target.performTasks(Target.java:369) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets (SingleCheckExecutor.java:37) at org.apache.tools.ant.Project.executeTargets(Project.java:1068) at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382) ... 13 more Caused by: java.lang.NullPointerException at org.apache.tools.ant.DirectoryScanner.isMorePowerfulThanExcludes (DirectoryScanner.java:1208) at org.apache.tools.ant.DirectoryScanner.couldHoldIncluded (DirectoryScanner.java:1167) at org.apache.tools.ant.DirectoryScanner.slowScan (DirectoryScanner.java:972) at org.apache.tools.ant.DirectoryScanner.getExcludedFiles (DirectoryScanner.java:1335) at org.apache.tools.ant.taskdefs.CloverCompilerAdapter.setJavac(1.3.5- build-598:285) at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:928) at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) at org.apache.tools.ant.Task.perform(Task.java:364) ... 19 more --- Nested Exception --- C:\Tools\AntHill\AllSDEJ\CuramSDEJ\build_scripts\build.xml:1140: java.lang.NullPointerException at org.apache.tools.ant.Task.perform(Task.java:373) at org.apache.tools.ant.Target.execute(Target.java:341) at org.apache.tools.ant.Target.performTasks(Target.java:369) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets (SingleCheckExecutor.java:37) at org.apache.tools.ant.Project.executeTargets(Project.java:1068) at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382) at org.apache.tools.ant.taskdefs.CallTarget.execute (CallTarget.java:107) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) at org.apache.tools.ant.Task.perform(Task.java:364) at org.apache.tools.ant.Target.execute(Target.java:341) at org.apache.tools.ant.Target.performTasks(Target.java:369) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) at org.apache.tools.ant.Project.executeTarget(Project.java:1185) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets (DefaultExecutor.java:40) at org.apache.tools.ant.Project.executeTargets(Project.java:1068) at org.apache.tools.ant.Main.runBuild(Main.java:668) at org.apache.tools.ant.Main.startAnt(Main.java:187) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67) Caused by: java.lang.NullPointerException at org.apache.tools.ant.DirectoryScanner.isMorePowerfulThanExcludes (DirectoryScanner.java:1208) at org.apache.tools.ant.DirectoryScanner.couldHoldIncluded (DirectoryScanner.java:1167) at org.apache.tools.ant.DirectoryScanner.slowScan (DirectoryScanner.java:972) at org.apache.tools.ant.DirectoryScanner.getExcludedFiles (DirectoryScanner.java:1335) at org.apache.tools.ant.taskdefs.CloverCompilerAdapter.setJavac(1.3.5- build-598:285) at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:928) at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) at org.apache.tools.ant.Task.perform(Task.java:364) ... 19 more --- Nested Exception --- java.lang.NullPointerException at org.apache.tools.ant.DirectoryScanner.isMorePowerfulThanExcludes (DirectoryScanner.java:1208) at org.apache.tools.ant.DirectoryScanner.couldHoldIncluded (DirectoryScanner.java:1167) at org.apache.tools.ant.DirectoryScanner.slowScan (DirectoryScanner.java:972) at org.apache.tools.ant.DirectoryScanner.getExcludedFiles (DirectoryScanner.java:1335) at org.apache.tools.ant.taskdefs.CloverCompilerAdapter.setJavac(1.3.5- build-598:285) at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:928) at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) at org.apache.tools.ant.Task.perform(Task.java:364) at org.apache.tools.ant.Target.execute(Target.java:341) at org.apache.tools.ant.Target.performTasks(Target.java:369) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets (SingleCheckExecutor.java:37) at org.apache.tools.ant.Project.executeTargets(Project.java:1068) at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382) at org.apache.tools.ant.taskdefs.CallTarget.execute (CallTarget.java:107) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) at org.apache.tools.ant.Task.perform(Task.java:364) at org.apache.tools.ant.Target.execute(Target.java:341) at org.apache.tools.ant.Target.performTasks(Target.java:369) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) at org.apache.tools.ant.Project.executeTarget(Project.java:1185) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets (DefaultExecutor.java:40) at org.apache.tools.ant.Project.executeTargets(Project.java:1068) at org.apache.tools.ant.Main.runBuild(Main.java:668) at org.apache.tools.ant.Main.startAnt(Main.java:187) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67) Total time: 31 seconds
Created attachment 14916 [details] just the stack trace of the failure
ah, I believe I see how DirectoryScanner.slowScan() is broken in 1.6.3 . Looks like a 1.6.4 release will be necessary. :(
a bug within ant version 1.6.3 that would be fixed in 1.6.4
not sure I understood that last comment. I'm about to attach a patched version of ant.jar, if you could verify that it fixes the problem.
I think the jar is too big for an attachment. I will attach the modified file as well as a diff. Let me know if you need me to e-mail the jar to you privately.
Created attachment 14919 [details] modified DirectoryScanner.java
Created attachment 14920 [details] diff
Matt, you can always publish the jar via http://people.apache.org/~mbenson/ +1 to your patch
I sent an e-mail to you with my address Cheers again
Got the jar and added it into the lib directory, then went and tried it out. Worked perfectly for all the normal ant builds, but when it came back to using clover with it i got the following error below, i'm not sure if this is an ant problem, but it works fine with ant 1.6.2 . BUILD FAILED C:\work\testWAS\CuramSDEJ\build_scripts\clover.xml:29: Could not create task or type of type: clover-setup. Ant could not find the task or a class this task relies upon. This is common and has a number of causes; the usual solutions are to read the manual pages then download and install needed JAR files, or fix the build file: - You have misspelt 'clover-setup'. Fix: check your spelling. - The task needs an external JAR file to execute and this is not found at the right place in the classpath. Fix: check the documentation for dependencies. Fix: declare the task. - The task is an Ant optional task and the JAR file and/or libraries implementing the functionality were not found at the time you yourself built your installation of Ant from the Ant sources. Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the task and make sure it contains more than merely a META-INF/MANIFEST.MF. If all it contains is the manifest, then rebuild Ant with the needed libraries present in ${ant.home}/lib/optional/ , or alternatively, download a pre-built release version from apache.org - The build file was written for a later version of Ant Fix: upgrade to at least the latest release version of Ant - The task is not an Ant core or optional task and needs to be declared using <taskdef>. - You are attempting to use a task defined using <presetdef> or <macrodef> but have spelt wrong or not defined it at the point of use Remember that for JAR files to be visible to Ant tasks implemented in ANT_HOME/lib, the files must be in the same directory or on the classpath Please neither file bug reports on this problem, nor email the Ant mailing lists, until all of these causes have been explored, as this is not an Ant bug. at org.apache.tools.ant.UnknownElement.getNotFoundException (UnknownElement.java:493) at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java (Compiled Code)) at org.apache.tools.ant.UnknownElement.maybeConfigure (UnknownElement.java(Compiled Code)) at org.apache.tools.ant.Task.perform(Task.java(Compiled Code)) at org.apache.tools.ant.Target.execute(Target.java(Compiled Code)) at org.apache.tools.ant.Target.performTasks(Target.java:369) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) at org.apache.tools.ant.Project.executeTarget(Project.java:1185) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets (DefaultExecutor.java:40) at org.apache.tools.ant.Project.executeTargets(Project.java:1068) at org.apache.tools.ant.Main.runBuild(Main.java:668) at org.apache.tools.ant.Main.startAnt(Main.java:187) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67) Total time: 1 minute 2 seconds
Sorry just haven't got the clover.jar file in the ant lib directory. I can probably suggest that this bug is now fixed and that it can be therefore closed?
Thanks for reporting the problem, and for testing the patch! Marking target as 1.7 for now but this will be in a 1.6.4 release in the near future.