You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Lynn Monson <lm...@flipdog.com> on 2001/02/23 00:42:54 UTC
Would someone review this patch?
Hi All,
I found a minor(?) bug in the current Xerces parser that causes an infinite
loop when parsing an empty input file. I've generated what I think is the
proper fix, but before I commit the change, I'd appreciate a second look
from anyone more familiar with the parser innards. The patch is attached...
Re: Would someone review this patch?
Posted by Arnaud Le Hors <le...@us.ibm.com>.
Lynn Monson wrote:
>
> Hi Arnaud,
>
> The key might be that you have to turn on the continue-after-fatal-error
> parsing flag. Admittedly, an empty file is a fatal error, and the parser is
> attempting to continue, but it shouldn't cause the parser to hang.
Ah! Now I undertand. And I agree the parser shouldn't go in an infinite
loop for that matter. (nor should it in any case actually).
> I've attached two files that duplicate the problem. ParseTest.java is a
> simple app that attempts to parse any xml files fed to it on the command
> line. empty.xml is simply a zero length file. To duplicate the problem,
> all I do is type:
>
> java ParseTest empty.xml
Yep. I was able to reproduce and your fix looks perfectly fine to me. I
say: go ahead, check it in.
--
Arnaud Le Hors - IBM Cupertino, XML Strategy Group
RE: Would someone review this patch?
Posted by Lynn Monson <lm...@flipdog.com>.
Hi Arnaud,
The key might be that you have to turn on the continue-after-fatal-error
parsing flag. Admittedly, an empty file is a fatal error, and the parser is
attempting to continue, but it shouldn't cause the parser to hang.
I've attached two files that duplicate the problem. ParseTest.java is a
simple app that attempts to parse any xml files fed to it on the command
line. empty.xml is simply a zero length file. To duplicate the problem,
all I do is type:
java ParseTest empty.xml
Re: Would someone review this patch?
Posted by Arnaud Le Hors <le...@us.ibm.com>.
Hi Lynn,
I'd be really interested to know how to reproduce the bug this is
solving. Similar problems have been reported before but I have never
been able to reproduce it. I just tried again feeding SAXCount with an
empty file and I get:
[Fatal Error] empty.xml:1:1: The root element is required in a
well-formed docum
ent.
--
Arnaud Le Hors - IBM Cupertino, XML Strategy Group