ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 50894] New: Invoking multiple targets that share the same dependency to augment a path causes NullPointerException
Date Tue, 08 Mar 2011 18:45:17 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=50894

           Summary: Invoking multiple targets that share the same
                    dependency to augment a path causes
                    NullPointerException
           Product: Ant
           Version: 1.8.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Core tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: rich@steelezone.net


Using this build file:

<project>

    <target name="foo" depends="aug">
        <echo message="${toString:p}" />
    </target>

    <target name="bar" depends="aug">
        <echo message="${toString:p}" />
    </target>

    <path id="p" />

    <target name="aug">
        <augment id="p">
            <path>
                <pathelement path="/" />
            </path>
        </augment>
    </target>

</project>

I can invoke each target, foo and bar, independently; for example

ant foo
Buildfile:
C:\dev\projects\ant-playground\augment-with-multiple-target\build.xml

aug:

foo:
     [echo] C:\

BUILD SUCCESSFUL

ant bar
Buildfile:
C:\dev\projects\ant-playground\augment-with-multiple-target\build.xml

aug:

bar:
     [echo] C:\

BUILD SUCCESSFUL

However, invoking both on the same command line causes an error:

ant foo bar
Buildfile:
C:\dev\projects\ant-playground\augment-with-multiple-target\build.xml

aug:

foo:
     [echo] C:\

aug:

BUILD FAILED
C:\dev\projects\ant-playground\augment-with-multiple-targets\build.xml:14:
java.lang.NullPointerException
        at
org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:376)
        at
org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:344)
        at org.apache.tools.ant.Task.maybeConfigure(Task.java:202)
        at org.apache.tools.ant.Task.perform(Task.java:347)
        at org.apache.tools.ant.Target.execute(Target.java:390)
        at org.apache.tools.ant.Target.performTasks(Target.java:411)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
        at org.apache.tools.ant.Main.runBuild(Main.java:809)
        at org.apache.tools.ant.Main.startAnt(Main.java:217)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

If foo and bar independently use augment, even for the same path (that is, they
don't use depends on a shared target) like this:

<project>

    <target name="foo">
        <augment id="p">
            <path>
                <pathelement path="/" />
            </path>
        </augment>
        <echo message="${toString:p}" />
    </target>

    <target name="bar">
        <augment id="p">
            <path>
                <pathelement path="/" />
            </path>
        </augment>
        <echo message="${toString:p}" />
    </target>

    <path id="p" />

</project>

the build works.

Needless to say, trying to retrain everyone to avoid using multiple targets on
the command line is proving to be difficult.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Mime
View raw message