ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Al Le" <Al...@gmx.de>
Subject MacroDef: Setting attribute via API should convert to lowercase
Date Tue, 12 Apr 2016 15:45:41 GMT
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

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message