users@jaxb.java.net

Re: Unmarshalling via InputStream

From: Ryan Shoemaker - JavaSoft East <Ryan.Shoemaker_at_Sun.COM>
Date: Fri, 22 Aug 2003 13:01:25 -0400

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