users@jaxb.java.net

RE: Re: Unmarshalling via InputStream

From: Malachi de Aelfweald <malachid_at_temporal-wave.com>
Date: Fri, 22 Aug 2003 11:37:34 -0700

Yes, I agree that it is in the Crimson code -- specifically
XmlReader$Utf8Reader.... Honestly, I don't know how to easily test
Xerces in place of JAXB. I have a solution that works, for now -- my
only point is that the API is misleading. People expect to be able to
pass ANY stream in, and get it to work. It doesn't.

I agree that the problem is in JAXP not JAXB. But since other solutions
(DOMParser) do work, it is still a bug, no?


Malachi

-----Original Message-----
From: Ryan Shoemaker - JavaSoft East [mailto:Ryan.Shoemaker_at_Sun.COM]
Sent: Friday, August 22, 2003 10:01 AM
To: users_at_jaxb.dev.java.net

Malachi de Aelfweald wrote:
> Ok, so here's the deal.... I implemented a MultiplexedInputStream
(and
> MultiplexedOutputStream). Calling unmarshal indirectly closes the
> stream BECAUSE XmlReader$Utf8Reader closes the stream once it is done
> reading. I am looking at overriding the close method, but..... there
> REALLY needs to be a better way to read/write JAXB from/to a SOCKET.
>

Understood, but it isn't JAXB's fault that the underlying parser is
closing the stream. In your case, we're simply using:

        org.xml.sax.XMLReader.parse( InputStream )

to unmarshal from your wrapped socket.

The javadoc says: "This method is synchronous: it will not return until
parsing has ended. If a client application wants to terminate parsing
early, it should throw an exception." The client owns the InputStream,
not the parser, so I've surprised that the parser would close it.

Just for kicks, can you try using Xerces to see how it behaves?

--Ryan


>
> reading taskman from the socket
> com.temporalwave.io.MultiplexedInputStream is closing!
> ** TRACE START
> com.temporalwave.util.RuntimeUtil(printStackTrace): line #-1
> com.temporalwave.util.RuntimeUtil(printStackTrace): line #-1
> com.temporalwave.io.MultiplexedInputStream(close): line #-1
> java.io.PushbackInputStream(close): line #303
> org.apache.crimson.parser.XmlReader$BaseReader(close): line #595
> org.apache.crimson.parser.XmlReader$Utf8Reader(read): line #647
> org.apache.crimson.parser.XmlReader(read): line #487
> org.apache.crimson.parser.InputEntity(fillbuf): line #1068
> org.apache.crimson.parser.InputEntity(isXmlDeclOrTextDeclPrefix): line
> #914
> org.apache.crimson.parser.Parser2(maybeXmlDecl): line #1150
> org.apache.crimson.parser.Parser2(parseInternal): line #620
> org.apache.crimson.parser.Parser2(parse): line #333
> org.apache.crimson.parser.XMLReaderImpl(parse): line #448
>
com.temporalwave.spec.taskman.impl.runtime.UnmarshallerImpl(unmarshal):
> line #-1
> javax.xml.bind.helpers.AbstractUnmarshallerImpl(unmarshal): line #131
> javax.xml.bind.helpers.AbstractUnmarshallerImpl(unmarshal): line #178
> com.temporalwave.util.JAXBUtil(read): line #-1
> com.temporalwave.taskman.server.RequestHandler(run): line #-1
> ** TRACE END


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net