Guys,

I've just started using jibx and have come across a problem with [my
use of] org.jibx.extras.TypedArrayMapper....

Imagine input that looks like this :

<A>
 <B.../>
 <B.../>
 <C.../>
 <C.../>
</A>

i.e. an 'A' owns a number of 'B's and a number of 'C's...

'A' might look like :

public class A
{
 public void setBs(B[] bs){...}
 public B[] getBs(){...}

 public void setCs(C[] bs){...}
 public C[] getCs(){...}
}

my binding.xml might look like this :

<binding>

 <mapping class="B[]"
   marshaller="org.jibx.extras.TypedArrayMapper"
   unmarshaller="org.jibx.extras.TypedArrayMapper"
   />

 <mapping name="B" class="B">
 </mapping>

 <mapping class="C[]"
   marshaller="org.jibx.extras.TypedArrayMapper"
   unmarshaller="org.jibx.extras.TypedArrayMapper"
   />

 <mapping name="C" class="C">
 </mapping>

 <mapping name="A" class="A">
  <structure set-method="setBs" get-method="getBs"/>
  <structure set-method="setCs" get-method="getCs"/>
 </mapping>

</binding>

I put together a testcase for the A's relationship with B - which
worked fine. However when I added the A-C relationship I found that as
the 'C's were parsed they where dumped into the same array as the
'B's. Jibx then attempts to pass a heterogeneous array of 'B's and
'C's (I assume into A.setCs()), but blows up with a java.lang.ArrayStoreException
in A.JiBX_binding2_unmarshal_2_0() because the array is of mixed type.


I have tried extending TypedArrayMapper into BMapper and CMapper and
using those in its place, but this does not seem to effect the problem
- in fact only one Mapper instance seems to get used, the other one
does not even get constructed before I encounter the error.

Perhaps I have misunderstood the intended use of these Mappers ?

Any help would be much appreciated - I can put together a testcase if
it would be of help.

Thanks for your time,


Jules

P.S.

I'm running beta3c on Sun 1.4.2_05




------------------------------------------------------- This SF.Net email is sponsored by: Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux. http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click _______________________________________________ jibx-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to