Raja Nagendra Kumar wrote:
Pl. find the fix for the same in ProjectComponent

We are defining a GOBAL_DEFAULT_PROJECT which would be same as the first non
null setProject call parameter.

getProject() value on any tag if null, the non null GOBAL_DEFAULT_PROJECT
value is assumed with debug log message saying about this assumption.


No, this is lethal. This code encodes a static variable with the assumption that its ok to hold a long-lived project instance. Every IDE that uses Ant, everything else that embeds ant will come and tell us off.

An NPE is a validity check to ensure that every task has an owning project. Not a friendly one, but one that certainly halts the app with a stack trace. Its something the developers get to see, usually the first time a task tries to log something. by the time the end users get to see it, it should have been fixed. That's the one nice thing about NPEs: they are hard to ignore.

Tasks that create other tasks should bind them with bindToOwner(ProjectComponent). This ensures that not only is project picked up, the child task even picks up the same name in the logs.

-steve

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org

Reply via email to