You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Eddie Robertsson <er...@allette.com.au> on 2002/03/21 06:50:42 UTC
Bug?
Hi all,
I posted this bug report in Bugzilla a couple of weeks ago (for version
2.0.0) and I never got a reply. Today I realized that the bug still
appears in 2.0.1 so is anyone else experiencing the same thing?
----------------------------------------
I'm getting an OutOfMemoryError when parsing an XML document that has
more than
one root element when parsing is done using a ByteArrayStream. Here is
my code:
// Text to parse
String text = "<Eddie/>\n<Eddie/>";
// Get an XMLReader instance
reader =
XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
// Register the Error handler
reader.setErrorHandler(errorHandler);
// DTD Validation
reader.setFeature("http://xml.org/sax/features/validation", true);
reader.setFeature("http://apache.org/xml/features/continue-after-fatal-error",
true);
// Create InputSource
InputSource inputSource = new InputSource(new
ByteArrayInputStream(text.getBytes()));
inputSource.setSystemId("c:\temp\test.xml");
reader.parse(inputSource);
This will just keep going until I get an OutOfMemoryError. Is this a bug
or am I
doing something wrong?
Cheers,
/Eddie
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Bug?
Posted by Andy Clark <an...@apache.org>.
Eddie Robertsson wrote:
> So, I guess this explains my memory error, the parser gets stuck in an
> infinate loop. However, I would still consider this a bug even though it's
> probably a low priority one.
Finding and correcting this kind of continue-after-fatal-error
problem is hard to do. Most likely it is due to an index into
the buffer used by the low-level entity scanner not being
advanced in a fatal situation. Therefore the scanner probably
gets stuck repeating the same thing over and over again. And
if it's appending to a buffer during this state, then that
would explain the out of memory exception that you get.
I don't have the time to look into this but if you want to,
search throughout the code for which components recognize the
continue after fatal error feature (look for the name of the
string constant defined in impl.Constants) and then examine
the cases where they continue after a fatal error. Might take
some time to figure out what's going on, though. Might be
useful to put printlns in the code at those points, rebuild,
and then see where it gets stuck in a loop.
If you find me the exact place in the source and give me a
small sample program that exhibits the problem, I'll try to
fix it if it isn't too hard.
--
Andy Clark * andyc@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Bug?
Posted by Eddie Robertsson <er...@allette.com.au>.
> So, I guess this explains my memory error, the parser gets stuck in an
> infinate loop. However, I would still consider this a bug even though it's
> probably a low priority one. Also, I noticed that it crash even if the only
> thing supplied to the parser is and empty element using the empty element
> tag:
>
> </eddie>
Argggh, I should check more carefully before sending my emails. An empty tag is of
course not written as </eddie> but instead <eddie/> which indeed work fine so
ignore my last observation.
Cheers,
/Eddie
>
>
> Thanks for your help!
>
> Cheers,
> /Eddie
>
> >
> >
> > --
> > Andy Clark * andyc@apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Bug?
Posted by Eddie Robertsson <er...@allette.com.au>.
Hi Andy,
> > I posted this bug report in Bugzilla a couple of weeks ago (for version
> > 2.0.0) and I never got a reply. Today I realized that the bug still
> > appears in 2.0.1 so is anyone else experiencing the same thing?
>
> Using the code you gave, I don't see an out of memory
> exception when running with Xerces 2.0.0. Instead, it
> correctly reports that the document is not well-formed.
> (Granted, it could have given a better error message
> but I don't get an out of memory exception.)
>
> Please be more precise in specifying the system and
> conditions under which you see this error.
Thanks for taking the time to test my problem. You're correct, I should have
checked the code more correctly when I gave the example below. What I forgot
to mention was that in my code I also have:
reader.setFeature("http://apache.org/xml/features/continue-after-fatal-error",
true);
After checking the documentation more carefully I also saw the following
text:
"The behavior of the parser when this feature is set to true is undetermined!
Therefore use this feature with extreme caution because the parser may get
stuck in an infinite loop or worse."
So, I guess this explains my memory error, the parser gets stuck in an
infinate loop. However, I would still consider this a bug even though it's
probably a low priority one. Also, I noticed that it crash even if the only
thing supplied to the parser is and empty element using the empty element
tag:
</eddie>
Thanks for your help!
Cheers,
/Eddie
>
>
> --
> Andy Clark * andyc@apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Bug?
Posted by Andy Clark <an...@apache.org>.
Eddie Robertsson wrote:
> I posted this bug report in Bugzilla a couple of weeks ago (for version
> 2.0.0) and I never got a reply. Today I realized that the bug still
> appears in 2.0.1 so is anyone else experiencing the same thing?
Using the code you gave, I don't see an out of memory
exception when running with Xerces 2.0.0. Instead, it
correctly reports that the document is not well-formed.
(Granted, it could have given a better error message
but I don't get an out of memory exception.)
Please be more precise in specifying the system and
conditions under which you see this error.
--
Andy Clark * andyc@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org