You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Shreedhar <sh...@amiindia.co.in> on 2006/07/11 12:29:53 UTC

classcast exception between build xmls

Hi All,

I have a problem with class casting. Here is the scenario -

I have an ant custom task say "mycustomA". Inside the execute method, I 
create a custom obj say "customobj" of a user-defined type. I store the 
"customobj" in the project reference using 
getProject().addReference("key",customobj).

I using mycustomA in a "build.xml". After invoking the task mycustomA I 
use ant task <ant> with inheritRefs=true to call another 
"buildsecond.xml"  Inside buildsecond.xml, I use a custom task say 
"mycustomB" which tries to get the reference of the customobj using the 
method getProject().getReference("key"). When I try to cast to the 
"customobj" type I get a classcast exception.

But customobj.getClass().getName() prints the exact type of customobj. 
But the instance of operator fails saying false. Is this any issue with 
class loader ?

I use java 1.5.0_06. What I am missing ?

Thank you,

Best regards
Shreedhar


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


Re: classcast exception between build xmls

Posted by sh...@amiindia.co.in.
anybody, any clue on this problem ?
> Hi All,
>
> I have a problem with class casting. Here is the scenario -
>
> I have an ant custom task say "mycustomA". Inside the execute method, I
> create a custom obj say "customobj" of a user-defined type. I store the
> "customobj" in the project reference using
> getProject().addReference("key",customobj).
>
> I using mycustomA in a "build.xml". After invoking the task mycustomA I
> use ant task <ant> with inheritRefs=true to call another
> "buildsecond.xml"  Inside buildsecond.xml, I use a custom task say
> "mycustomB" which tries to get the reference of the customobj using the
> method getProject().getReference("key"). When I try to cast to the
> "customobj" type I get a classcast exception.
>
> But customobj.getClass().getName() prints the exact type of customobj.
> But the instance of operator fails saying false. Is this any issue with
> class loader ?
>
> I use java 1.5.0_06. What I am missing ?
>
> Thank you,
>
> Best regards
> Shreedhar
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>


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