I'm seeing another problem with Ant 1.6.2 for a target that previously
worked in 1.6.1.

I have a test and functest target that I run during a single build (e.g.
'ant clean test functest dist'). The test targets rely on  instrumenting
the code with jcoverage before the tests run, e.g.:

            <!-- Run the func tests -->
        <target name="functest" 
                    depends="instrument" 
                    description="Runs the func test suite. Requires the
J2EE server to be running">
                <batch-junit
                        test.src.dir="${functest.src.dir}"
                    cp="classpath.functest"
        
junit.results.dir="${junit.functest.results.dir}"
                    junit.report.dir="${junit.functest.report.dir}"
                    fail.on.failure="true"/>            
                <coverage-report 
        
build.coverage.report.dir="${build.coverage.report.dir}" />

        </target>

      <!-- Instruments the source code -->
        <target name="instrument" 
                    depends="compile" 
                    description="Add jcoverage instrumentation">
                <!-- Declare the jcoverage task -->
            <taskdef classpathref="classpath.build"
resource="tasks.properties" />  
                <!--
                      instrument the application classes, writing the
instrumented
                      classes into ${build.instrumented.dir}.
                    -->
                <instrument todir="${build.instrumented.classes.dir}">
                        <!--
                        Note that the following line causes instrument
to ignore any
                        source line containing a reference to log4j, for
the purposes
                        of coverage reporting.
                      -->
                        <ignore regex="org.apache.log4j.*" />

                        <fileset dir="${build.classes.dir}">
                                <!--
                          instrument all the application classes, but
don't instrument
                          the test classes.
                        -->
                                <include name="**/*.class" />
                        </fileset>
                </instrument>
        </target>       

The problem is that if I run multiple test targets that reexecute this
instrument target, I get the following exception:

BUILD FAILED
java.lang.NullPointerException
        at
org.apache.tools.ant.IntrospectionHelper.supportsNestedElement(Intros
pectionHelper.java:767)
        at
org.apache.tools.ant.UnknownElement.handleChild(UnknownElement.java:5
39)
        at
org.apache.tools.ant.UnknownElement.handleChildren(UnknownElement.jav
a:326)
        at
org.apache.tools.ant.UnknownElement.configure(UnknownElement.java:182
)
        at
org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.jav
a:158)
        at org.apache.tools.ant.Task.getReplacement(Task.java:433)
        at org.apache.tools.ant.Task.perform(Task.java:383)
        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.executeTarget(Project.java:1214)
        at
org.apache.tools.ant.Project.executeTargets(Project.java:1062)
        at org.apache.tools.ant.Main.runBuild(Main.java:673)
        at org.apache.tools.ant.Main.startAnt(Main.java:188)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)

If I run only one of the test targets, everything works correctly. I'm
thinking that this is a similar problem to the Xdoclet and Macro bugs
that I have encountered in the past where the tasks don't reexecute
correctly.

Reply via email to