Millies, Sebastian wrote:

-----Original Message-----
From: Simon Nash [mailto:[email protected]]
Sent: Wednesday, January 26, 2011 3:25 PM
To: [email protected]
Subject: SDO problem: Re: FW: Escaping illegal characters during
(un)marshalling

Millies, Sebastian wrote:
-----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

I added "SDO problem" to the subject line in the hope that this may
bring this problem to the attention of someone with SDO expertise.

In the unmarshal stack trace I see some Java serialization methods
making
calls to read data from an ObjectInputStream.  Does this
ObjectInputStream
contain invalid XML data?  It might help with debugging if you could
post
more details of the contents of the ObjectInputStream, together with a
complete stack trace.

   Simon

I attach a little Eclipse project that demonstrates the problem.
Unzip, compile, run server.Launcher, then run client.Client.
You'll get the exception in Client.java line 44.

-- Sebastian

I have been able to recreate the problem and I've debugged it through
the Tuscany SCA code as far as I can.

After the service invocation, Tuscany SCA correctly returns an object
of type DynamicDataObjectImpl to the RMI marshalling framework.  The
problem occurs when RMI marshals and unmarshals the DynamicDataObjectImpl
object.  This is presumably because the writeExternal() and
readExternal() methods of DynamicDataObjectImpl don't support special
characters embedded in strings.

I can't take this any further because I don't have the specialist
SDO knowledge that would be needed to find the root cause of the
problem.  The best suggestion I can make is to raise a JIRA against
SDO, attaching your test case.

  Simon

Reply via email to