Explain mysterious class name in XStream XML stream -


i'm using xstream 1.4.8 serialize , xml, when sending data through rabbitmq. in cases, class name added generated xml, breaks deserialization. difficult problem me explain in production, xml value not generate exception, while in dev, exception.

the badly serialized xml:

<company.events.twitter.interactionreceivedfromtwitter4>     <header>         <id serialization="custom">             <com.eaio.uuid.uuid>                 <long>4426172843343876581</long>                 <long>-7002731889965487449</long>             </com.eaio.uuid.uuid>         </id>         <date>1433342326156</date>         <data class="scala.collection.immutable.map$emptymap$"/>     </header>     <!-- more data fields --> </company.events.twitter.interactionreceivedfromtwitter4> 

this xml cannot serialized, was generated xstream 1.4.8. if edit xml , remove <com.eaio.uuid.uuid> , corresponding closing tags (just tags) , leave content, xml correctly deserialize.

i want understand how , why notation added. code use serialize , deserialize:

class xstreamserializer extends serializer {     private val xstream = new xstream      def serialize(x: anyref) = xstream.toxml(x).getbytes      def deserialize(data: array[byte], contenttype: string) = {         if (contenttype != serializationcontenttype)             throw new illegalargumentexception("can decode " + serializationcontenttype + ", received " + contenttype)          val res = xstream.fromxml(new bytearrayinputstream(data))          option(res)     }      def serializationcontenttype = "application/xml;charset=utf-8" }  case class messageheader( id: uuid,  date: long,  data: map[string, string]) case class interactionreceivedfromtwitter4(header: messageheader,                                            correlationid: uuid,                                            interaction: interactionmessage,                                            persona: interactionpersona) 

in development, never see class mention. can "fix" removing strings "" , close tag, want understand.

i don't care data format exchanged on-the-wire. whether class name there or not doesn't matter me.

i managed track down issue. use scala 2.9.0.1 on deserialization side, , scala 2.11.4 on serializing side. java objects scala 2.11 generates structurally different scala 2.9.0.1 java objects, should explain difference.

i tracked down difference in uuid library using, 3.4 on deserialization side, 3.2 on serialization one.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -