DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3862>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3862 DocumentBuilder.parse(InputStream) closes InputStream Summary: DocumentBuilder.parse(InputStream) closes InputStream Product: Xerces-J Version: 1.4.3 Platform: PC OS/Version: Windows NT/2K Status: NEW Severity: Normal Priority: Other Component: JAXP AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] When calling DocumentBuilder.parse(InputStream in), parsing continues until end of stream, at which point the stream in closed. When parsing input from a Socket, this closes the Socket, too, meaning that you can't write your response back to the OutputStream. The correct way of shuting down a SocketInputStream is to call socket.shutDownInput(). Obviously, an XML parser should not be expected to do this (it doesn't have a handle to the Socket, for a start). I don't believe that closing any InputStream passed as a parameter to a method is good design, as this places additional contractual constraints between the class implementating that method and the class calling the method. A better approach would be to require the calling code to close the stream after the call to parse. If the code that creates the stream, closes the stream, then responsibilities are clearly defined. (This also becomes an application of the template method design pattern.) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
