xerces-j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xerces-j-...@xml.apache.org
Subject [jira] Updated: (XERCESJ-1015) Zero byte read on InputStream causes false SAXParseException when LF at end of file
Date Fri, 01 Oct 2004 16:41:32 GMT
The following issue has been updated:

    Updater: larry oneill (mailto:loneill7@gmail.com)
       Date: Fri, 1 Oct 2004 9:41 AM
java RepeatingParser <xmlFile> <int:iterations <int:failOnIteration> [boolean

If the file is over 2k in size, an ArrayIndexOutOfBoundsException will be shown, as the artificial
zero byte read is generated on the second byte array read (after 2048 bytes).
If the 4th arg is 'true' and the XML file ends with a Unix style LF, a SAXParseException will
be thrown with one of the two messages mentioned in the description.
             Attachment changed to RepeatingParser.java
For a full history of the issue, see:


View the issue:

Here is an overview of the issue:
        Key: XERCESJ-1015
    Summary: Zero byte read on InputStream causes false SAXParseException when LF at end of
       Type: Bug

     Status: Unassigned
   Priority: Major

    Project: Xerces2-J

   Reporter: larry oneill

    Created: Fri, 1 Oct 2004 9:36 AM
    Updated: Fri, 1 Oct 2004 9:41 AM
Environment: Windows XP, 586

Under the following circumstances false SAXParseExceptions are thrown.

When a document is being parsed and has reached the end of the document.
If the InputStream supplying the document returns a 0 length indicator (meaning no bytes currently
available) AND
There is a Line Feed character at the end of the file, after the last element (without a carriage
Then a false SAXParseException with one of the two following messages is thrown:
"Content is not allowed in trailing section"
"The markup in the document following the root element must be well-formed"

This could happen if the InputStream is reading from a buffer whose writer thread has returned
a 0 instead of -1 when the buffer is closed. While the writer to the buffer should return
a -1 on buffer close, in practice this may not always happen and Xerces should cater for it.
 It certainly should not throw a spurious exception.

If a zero byte count is returned by an InputStream read while reading in the middle of the
document an ArrayIndexOutOfBounds exception is thrown.

I will include sample code to demonstrate both of these cases and a possible fix for the problem.

This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:

If you want more information on JIRA, or have a bug to report see:

To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org

View raw message