dependset throws a NullPointerException. The failure appears to occur at the point where DependSet.uptodate() sorts the list of sources, and gets the first element of the list. (line 233 in DependSet.java). This works correctly in Version 1.6.5. Stack trace from log: --- Nested Exception --- java.lang.NullPointerException at org.apache.tools.ant.types.resources.Sort$SortedBag$MutableInt.access$100(Sort.java:44) at org.apache.tools.ant.types.resources.Sort$SortedBag$MyIterator.next(Sort.java:60) at org.apache.tools.ant.types.resources.FailFast.next(FailFast.java:115) at org.apache.tools.ant.taskdefs.DependSet.uptodate(DependSet.java:233) at org.apache.tools.ant.taskdefs.DependSet.execute(DependSet.java:202) 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:585) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) 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:1329) at org.apache.tools.ant.Project.executeTarget(Project.java:1298) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1181) at org.apache.tools.ant.Main.runBuild(Main.java:698) at org.apache.tools.ant.Main.startAnt(Main.java:199) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Created attachment 19350 [details] Contains test files and output log.
Note that the problem only occurs when the target file exists.
Hi Joseph, I have DLd your attachment but it does not contain a complete self-hosting environment. I tried to compensate for that fact but have not been able to reproduce the NPE. A more complete build would be helpful. It might also be helpful to know what Java version you are using. Thanks, Matt
The source (src) directory for the sandbox where this bug occurred contains 5448 .java files and 127 .jsp files in numerous directories. Can't really share all that (size is prohibitive, and the source is proprietary). java -version returns java version "1.5.0_09" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_09-b03) Java HotSpot(TM) Client VM (build 1.5.0_09-b03, mixed mode, sharing)
(In reply to comment #4) > The source (src) directory for the sandbox where this bug occurred contains 5448 > .java files and 127 .jsp files in numerous directories. Can't really share all > that (size is prohibitive, and the source is proprietary). > > java -version returns > java version "1.5.0_09" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_09-b03) > Java HotSpot(TM) Client VM (build 1.5.0_09-b03, mixed mode, sharing) Based on size alone, I certainly wouldn't want you to share all that. At the same time, I can slap a few files into various directories under src/ and I don't get the NPE. So there must be something unique to your directory structure that triggers the error. The most important component of a bugreport is as small as possible a self-contained example that triggers the problem. You've got to help us help you... :|
In an artificial environment where I have only tested the SortedBag I am able to reproduce this error, that is the same error occurs in case the object in the TreeMap is changed, so that its position in the map changes. Because of this the key retrieved using the key iterator cannot be found anymore in the map (because its position according to its ordering has changed.) In this case it probably implies that the Newest File isn't the Newest anymore...
If this was the cause it is fixed in head now, please verify.
Created attachment 19478 [details] Output log and fragment of correctly sorted list of java files I have tested the fix (nightly build apache-ant-20070128). The NPE is gone, but the sort is not working correctly. I tested this in both in our actual development sandbox and in the ant directory. If you drop the test files I originally attached into the ant directory and run ant -f problem.xml, the first time thru it should create the BuildID.properties file (because it doesn't exist). If you then touch an arbitrary .java source file and re-run, it should create a new BuildID.properties with a new date-time stamp. It doesn't. I've attached a zip with the log from such a run on my machine and a fragment of an externally-sorted list of all the .java files, and this clearly shows that the sort in DependSet is not properly ordering the files.
The nightly builds do not seem to pick up the recent changes, (also this bug is not fixed in the nightly build of the 29th) these builds still contain the wrong classes. The behaviour you observed is described in another report. (Bugzilla report 41411)
I have put a manual build (on windows, unix permission will be wrong!) on: http://people.apache.org/~jkf/apache-ant-20070130-bin.tgz
The manual build supplied (apache-ant-20070130-bin.tgz) does appear to fix the problem. Thanks, guys! Joe T.
*** Bug 44368 has been marked as a duplicate of this bug. ***