You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2011/03/08 19:45:17 UTC

DO NOT REPLY [Bug 50894] New: Invoking multiple targets that share the same dependency to augment a path causes NullPointerException

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.

DO NOT REPLY [Bug 50894] Invoking multiple targets that share the same dependency to augment a path causes NullPointerException

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50894

Jesse Glick <jg...@netbeans.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jglick@netbeans.org
   Target Milestone|---                         |1.8.3

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

DO NOT REPLY [Bug 50894] Invoking multiple targets that share the same dependency to augment a path causes NullPointerException

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50894

Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #1 from Stefan Bodewig <bo...@apache.org> 2011-07-27 14:08:28 UTC ---
fixed with svn revision 1151473

The patch should work standalone with Ant 1.8.2 as well.

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