MacroDef: Setting attribute via API should convert to lowercase
"Al Le" <[email protected]>
| Newsgroups | gmane.comp.jakarta.ant.user |
|---|---|
| Message-ID | <trinity-e5b09be3-f969-4284-870c-5746613d3eac-1460475941476@3capp-gmx-bs55> |
Hello,
in my ant script, I define a task "MyTask" via "macrodef". The task has a mandatory attribute "nodeName" (not the camelCase name).
Then I call the task from a javascript snippet:
var myTask = project.createTask('myTask');
myTask.setDynamicAttribute("nodeName", "blah");
myTask.perform();
This does not work because I use the camleCase name in the call to setDynamicAttribute. Later, when the task is performed, I get an error that the attribute "nodename" (lowercase!) is not set.
In the source of MacroInstance I see that attribute names are converted to lower case when they are retrieved. But why are they not converted when they are set?
When I use this (note the lowercase name)
myTask.setDynamicAttribute("nodename", "blah");
everything works. But here I''m forced to use an attribute name I didn't specify (I specified "nodeName").
Why is it made this way?
I see one reason for converting everything to lower case -- to avoid errors due to a wrong capitalizing. But then the conversion should be done everywhere, i.e. when getting and when setting the attributes.
Regards
AL