Bug 23972 - [antrunner] NPE with XmlLogger as listener
Summary: [antrunner] NPE with XmlLogger as listener
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 2.0   Edit
Hardware: Other other
: P1 normal (vote)
Target Milestone: 2.1 M2   Edit
Assignee: Luc Bourlier CLA
QA Contact:
URL:
Whiteboard:
Keywords: core
Depends on:
Blocks:
 
Reported: 2002-09-23 07:32 EDT by Gunnar Wagenknecht CLA
Modified: 2002-10-14 10:41 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gunnar Wagenknecht CLA 2002-09-23 07:32:52 EDT
When using "-listener org.apache.tools.ant.XmlLogger".

     [exec] java.lang.reflect.InvocationTargetException: 
java.lang.NullPointerException
     [exec]     at org.apache.tools.ant.XmlLogger.buildFinished
(XmlLogger.java:119)
     [exec]     at 
org.eclipse.ant.internal.core.ant.InternalAntRunner.fireBuildFinished
(InternalAntRunner.java:507)
     [exec]     at org.eclipse.ant.internal.core.ant.InternalAntRunner.run
(InternalAntRunner.java:305)
     [exec]     at org.eclipse.ant.internal.core.ant.InternalAntRunner.run
(InternalAntRunner.java:443)
     [exec]     at java.lang.reflect.Method.invoke(Native Method)
     [exec]     at org.eclipse.ant.core.AntRunner.run(AntRunner.java:338)
     [exec]     at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:775)
     [exec]     at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462)
     [exec]     at java.lang.reflect.Method.invoke(Native Method)
     [exec]     at org.eclipse.core.launcher.Main.basicRun(Main.java:247)
     [exec]     at org.eclipse.core.launcher.Main.run(Main.java:703)
     [exec]     at org.eclipse.core.launcher.Main.main(Main.java:539)
Comment 1 Darin Swanson CLA 2002-09-23 17:50:58 EDT
On the current stream (which will be coming to light in the next weeks 
integration build and is available in the nightly builds), I fixed the problem 
with a reordering of when buildStarted(BuildEvent) was called and where the 
log.xml file was generated.
Comment 2 Darin Swanson CLA 2002-09-23 17:51:23 EDT
Please verify (Jared)
Comment 3 Gunnar Wagenknecht CLA 2002-09-24 02:31:29 EDT
With the nightly build N22020924 I get another NPE.

[exec] Using 
Y:\rnd_beehive_source_eclipse_vob\build\internal\estudio\logxyz.xml file as 
build log.
[exec] java.lang.reflect.InvocationTargetException: 
java.lang.NullPointerException
[exec]     at org.apache.tools.ant.XmlLogger.messageLogged(XmlLogger.java:237)
[exec]     at org.apache.tools.ant.Project.fireMessageLoggedEvent
(Project.java:982)
[exec]     at org.apache.tools.ant.Project.fireMessageLogged(Project.java:988)
[exec]     at org.apache.tools.ant.Project.log(Project.java:246)
[exec]     at org.apache.tools.ant.Project.setProperty(Project.java:269)
[exec]     at 
org.eclipse.ant.internal.core.ant.InternalAntRunner.fireBuildFinished
(InternalAntRunner.java:573)
[exec]     at org.eclipse.ant.internal.core.ant.InternalAntRunner.run
(InternalAntRunner.java:496)
[exec]     at org.eclipse.ant.internal.core.ant.InternalAntRunner.run
(InternalAntRunner.java:421)
[exec]     at java.lang.reflect.Method.invoke(Native Method)
[exec]     at org.eclipse.ant.core.AntRunner.run(AntRunner.java:356)
[exec]     at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:775)
[exec]     at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462)
[exec]     at java.lang.reflect.Method.invoke(Native Method)
[exec]     at org.eclipse.core.launcher.Main.basicRun(Main.java:247)
[exec]     at org.eclipse.core.launcher.Main.run(Main.java:703)
[exec]     at org.eclipse.core.launcher.Main.main(Main.java:539)

Comment 4 Darin Swanson CLA 2002-09-26 11:45:57 EDT
I believe another bug was causing this.
The InternalAntRunner was always calling buildFinished even in cases where it 
had not called build started.
I believe this made it into the 20020926 nightly build.
Gunnar can you please give me the exact steps that were causing the NPE so I 
can ensure that all are fixed this time.
Comment 5 Gunnar Wagenknecht CLA 2002-09-27 01:58:40 EDT
nothing special

I just ran the following target in my build.xml

<!-- executes the eclipse ant from within eclipse (should work on any os) -->
<target name="eclipse.ant" if="eclipse.ant.buildfile.verified">
  <exec executable="${temp.eclipse}/eclipse" dir="${eclipse.ant.dir}" 
failonerror="true">
    <arg line="-nosplash -data ${temp.eclipse}/buildworkspace -application 
org.eclipse.ant.core.antRunner -listener org.apache.tools.ant.XmlLogger -
logfile somelog.xml -Dinstall.path=${temp.estudio} -
Dplugin.path=file:${temp.estudio}/plugins/,file:${temp.eclipse}/plugins/ -
Dos=${os} -Dws=${ws} -Darch=${arch} -buildfile ${eclipse.ant.buildfile} 
${eclipse.ant.target}"/>
  </exec>
</target>

Comment 6 Gunnar Wagenknecht CLA 2002-09-27 03:32:05 EDT
It seems that the build file never get executed. The fireBuildFinished() is 
called before the build is finished ?!?

With N20020927 the NPE is still there but with a slightly different stack trace.

java.lang.reflect.InvocationTargetException
  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:324)
  at org.eclipse.ant.core.AntRunner.run(AntRunner.java:355)
  at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:775)
  at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462)
  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:324)
  at org.eclipse.core.launcher.Main.basicRun(Main.java:247)
  at org.eclipse.core.launcher.Main.run(Main.java:703)
  at org.eclipse.core.launcher.Main.main(Main.java:539)
Caused by: java.lang.NullPointerException
  at org.apache.tools.ant.XmlLogger.messageLogged(XmlLogger.java:237)
  at org.apache.tools.ant.Project.fireMessageLoggedEvent(Project.java:982)
  at org.apache.tools.ant.Project.fireMessageLogged(Project.java:988)
  at org.apache.tools.ant.Project.log(Project.java:246)
  at org.apache.tools.ant.Project.setProperty(Project.java:269)
  at org.eclipse.ant.internal.core.ant.InternalAntRunner.fireBuildFinished
(InternalAntRunner.java:587)
  at org.eclipse.ant.internal.core.ant.InternalAntRunner.run
(InternalAntRunner.java:511)
  at org.eclipse.ant.internal.core.ant.InternalAntRunner.run
(InternalAntRunner.java:425)
  ... 14 more
Comment 7 Gunnar Wagenknecht CLA 2002-09-27 03:39:42 EDT
the error also pops up if I start the ant runner with an invalid build file.
Comment 8 Darin Swanson CLA 2002-09-27 09:54:26 EDT
I can reproduce the problem...thanks Gunnar.  Working on a solution.
Comment 9 Darin Swanson CLA 2002-09-27 11:14:36 EDT
Eclipse Ant as an IPlatformRunnable application had not been tested much on the 
new code base(sorry, different entry point into the code).

Fixed the handling of command line arguments, non-existant build file and error 
reporting after the build was finished.

Gunnar if you get the chance could you verify?
Comment 10 Darin Swanson CLA 2002-09-30 10:06:28 EDT
Please verify (Jared)
Comment 11 Darin Swanson CLA 2002-10-11 09:00:22 EDT
Reopening to reassign as must be verified for M2
Comment 12 Darin Swanson CLA 2002-10-11 09:01:28 EDT
Please verify (Luc)
Comment 13 Darin Swanson CLA 2002-10-11 09:58:02 EDT
Marking as fixed.
Comment 14 Luc Bourlier CLA 2002-10-14 10:41:51 EDT
Verified.
Please update the build notes (darinS)