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=5079>.
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=5079

Closing InputStreams/Readers





------- Additional Comments From [EMAIL PROTECTED]  2001-11-26 06:40 -------
>AbstractSAXParser.parse(String) has some code to close the
>InputStream/Reader, but this looks very fishy: XMLReader.parse(String
>s) should be equivalent to parse(new InputSource(systemId)), but it's
>not in respect of closing.  Surely this should be dealt with an the
>XNI level not the SAX level.

I do not know if this is historical, or still a problem with Xerces 2,
but the code you mention is an artifact of a defect in the way SAX was
(is?) implemented in Xerces.  The entity management would actually take
the stream created from the systemId and store it in the InputSource
passed by the caller, which is prohibited (InputSource JavaDoc):

"An InputSource object belongs to the application: the SAX parser shall never 
modify it in any way (it may modify a copy if necessary)."

That is what the "fishy" code is trying to cover up for.  Since the parser
itself has created the InputSource object, it owns that object and tries to
close any streams that the parser might have left open.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to