[jdom-interest] SAXBuilder hang when using InputStream

Joseph Bowbeer jozart at csi.com
Thu Feb 28 03:46:06 PST 2002

See if this item in the FAQ helps:

 Why does passing a document through a socket sometimes hang the parser?

Specifically: In your server, try reading the input stream into a buffer
before handing it off to SAXBuilder.

--- original message ---

From: uwaibel at t-online.de (Uli Waibel)
To: <jdom-interest at jdom.org>
Date: Wed, 27 Feb 2002 17:54:15 +0100
Subject: SAXBuilder hang when using InputStream

i try to build a document with SAXBuilder.build(java.io.InputStream);
The Inputstrem object is from a socket object.  My client create a
document and send it with XMLOutputter to a server.

<<< Client >>>
XMLOutputter printer = new XMLOutputter();
BufferedOutputStream out = new BufferedOutputStream(
tester.getOutputStream() ); // tester is a socket object

<<< Server >>>
SAXBuilder builder = new SAXBuilder(false);
Document doc = builder.build(in);  <<-- it never comes back from
XMLOutputter printer = new org.jdom.output.XMLOutputter();
catch( java.io.IOException e ){e.printStackTrace();}

If the client closes the socket, I receive a the exception
org.jdom.JDOMException: Error in building: socket closed (code=0)

Sending the data (XMLOutputter.putput(doc,out) is working,
I checked these with a simple socket read on server side.

I tried these with JDOM 1.0Beta7 and with the latest version from CVS,
same error.

Has anybody an idear whats going wrong ?


Uli Waibel

More information about the jdom-interest mailing list