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 2016/04/17 00:41:31 UTC

[Bug 59339] New: Setting attribute via direct call to setDynamicAttribute does not work for a task defined via macrodef

https://bz.apache.org/bugzilla/show_bug.cgi?id=59339

            Bug ID: 59339
           Summary: Setting attribute via direct call to
                    setDynamicAttribute does not work for a task defined
                    via macrodef
           Product: Ant
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
          Assignee: notifications@ant.apache.org
          Reporter: al.le@gmx.de

I create a task via macroDef. The task has a mandatory attribute whose name is
camel case. Later in the build script, I create an instance of the task in a
JavaScript snippet, set the attribute value via a call to setDynamicAttribute,
and execute the task.

I get the error message that the attribute is not set.

If in the call to setDynamicAttribute I specify the attribute name in lower
case, everything works as expected.

A problem from the same area was reported and fixed in Bug 25687.


Here's an example:

<project default="MyTarget">

    <macrodef name="MyEcho">
        <attribute name="myMessage"/> <!-- Note the camel case name -->
        <sequential>
            <echo>@{myMessage}</echo>
        </sequential>
    </macrodef>

    <target name="MyTarget">
        <script language="JavaScript">
            var myTask = project.createTask("MyEcho");

            // The following line does not work despite the fact that the
            // attribute name is spelled correctly, i.e. as camelCase
            myTask.setDynamicAttribute("myMessage", "Hello");

            // The following line would work
//            myTask.setDynamicAttribute("mymessage", "Hello");

            myTask.perform();
        </script>
        <!--MyEcho myMessage="Hello"/--> <!-- This works as well -->
    </target>

</project>

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59339] Setting attribute via direct call to setDynamicAttribute does not work for a task defined via macrodef

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |1.9.8
         Resolution|---                         |FIXED
            Version|unspecified                 |1.9.7
             Status|NEW                         |RESOLVED

--- Comment #1 from Stefan Bodewig <bo...@apache.org> ---
should be fixed with vcommit 03481a6 on the 1.9.x branch.

Will also be fixed for 1.10.0 with commit f6e6c20 on master.

-- 
You are receiving this mail because:
You are the assignee for the bug.