> -----Original Message-----
> From: Simon Nash [mailto:[email protected]]
> Sent: Monday, January 24, 2011 8:50 PM
> To: [email protected]
> Subject: Re: Escaping illegal characters during (un)marshalling
> 
> Millies, Sebastian wrote:
> > Hello there,
> >
> > I’m using SDO’s over an RMI binding in Tuscany 1.6.1.
> > I'm running into a problem when the SDO has a String attribute
> > (defined as <xsd:string>) and the string contains valid UTF-8
> > characters that are illegal in XML (e.g. ‘\u001f’). The SDO gets
> > serialized by JAXB without escaping/encoding these bytes, effectively
> > producing illegal XML.
> >
> > When I later try to unmarshal these objects, the unmarshaller
> crashes.
> > Here’s the relevant part of the stack trace:
> >
> > Caused by: java.rmi.UnmarshalException: error unmarshalling return;
> nested exception is:
> >     java.io.EOFException
> >     at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:173)
> >     at
> java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(Remote
> ObjectInvocationHandler.java:178)
> >     ... 41 more
> > Caused by: java.io.EOFException
> >     at
> java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.j
> ava:2281)
> >     at
> java.io.ObjectInputStream$BlockDataInputStream.readInt(ObjectInputStrea
> m.java:2774)
> >     at java.io.ObjectInputStream.readInt(ObjectInputStream.java:950)
> >     at
> org.apache.tuscany.sdo.spi.HelperProviderBase$ResolvableImpl.readDataOb
> ject(HelperProviderBase.java:211)
> >     at
> org.apache.tuscany.sdo.spi.HelperProviderBase$ResolvableImpl.readExtern
> al(HelperProviderBase.java:161)
> >     at
> commonj.sdo.impl.ExternalizableDelegator.readExternal(ExternalizableDel
> egator.java:83)
> >
> > I guess this is purely a JAXB issue? But could it not be worked
> around in Tuscany?
> >
> > -- Sebastian
>  >
> Why is JAXB involved when serializing an SDO?  The serialization
> should be done by SDO, not by JAXB.  Can you give more details about
> what you are doing in the application that results in an SDO being
> serialized by JAXB?
> 
>    Simon

sorry, my mistake. I was simply assuming that behind the scenes SDO's
would always be serialized to XML using JAXB. However, the fact remains
that it is impossible to unmarshall an SDO when it has a string-valued
attribute that contains characters invalid in XML.

Is that a documented restriction on SDOs? I found nothing in the spec.
It says quite simply that <xsd:string> is mapped to java.lang.String.

-- Sebastian

Reply via email to