Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ant task inheritRefs attribute is not working as expected

Mohit Jagetia
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have a problem in downcasting the attached reference to a project (when i call the target from another build file).

- The downcasting works fine in the same ant build file.
- Also it works for simple types eg. string, int etc. but not for complex type eg. class having mixed datatype int, string or other classes

I have a main build.xml calling target "Target2" of build2.xml using task "Ant"
All the references and properties are expected to be transfer to Target2 and should be retrieved / casted to the original types.

For the above senario i created a custom task "mainTask" which create an instance of Subq object and uses addReference() method of Project class to attach the reference of it

This attached reference is expected to pass to the Target2 of build2.xml file with following ant task

In the Target2 of build2.xml i have another custom task which prints all the references received and try to retrive the attached reference "myobj1"

I can see the reference "myobj1" in hashtable with hastable.toString() method

I check the type of the object

But when i try to cast it with Subq it throws ClassCastException

Ay Help will be greatly appreciated.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic