Hey there,

currently, I am evaluating XStream and ran into some problems with it. I
serialized the following data container:

package data;

@XStreamAlias("shortarray")
public class ShortArrayContainer {
        @XStreamAsAttribute
        public short[] values;
}

This serializes into something like (using stream.toXML(container,
out)):

<shortarray>
  <values>
    <short>16383</short>
    <short>16384</short>
    <short>16385</short>
    <short>16386</short>
    <short>16387</short>
  </values>
</shortarray>

stream is initialized with 
        stream = new XStream(new DomDriver("UTF-8"));
        stream.autodetectAnnotations(true);

Unfortunately, I get a ConversionException, when I try to deserialize
with stream.fromXML(in):

com.thoughtworks.xstream.converters.ConversionException: array element
type mismatch : array element type mismatch
---- Debugging information ----
message             : array element type mismatch
cause-exception     : java.lang.IllegalArgumentException
cause-message       : array element type mismatch
class               : [Ljava.lang.Short;
required-type       : [Ljava.lang.Short;
converter-type      :
com.thoughtworks.xstream.converters.collections.ArrayConverter
path                : /shortobjectarray/values
class[1]            : data.ShortObjectArrayContainer
converter-type[1]   :
com.thoughtworks.xstream.converters.reflection.ReflectionConverter
version             : 1.4.5
-------------------------------

Interestingly, I observed no problems when I am doing this with byte or
boolean arrays.

I already tried playing around with Short vs short and List instead of
arrays without much success.

Any help is welcome,
Dirk



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to