|
[XML-DEV Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
[SAX2] BUG in AttributesImpl
- From: Sebastien Sahuc <ssahuc@i...>
- To: David Megginson <david@m...>, xml-dev@l...
- Date: Wed, 18 Oct 2000 22:23:23 +0100
Title: [SAX2] BUG in AttributesImpl
Hi,
I Still can't believe I'm reporting a bug in SAX2 :-)
Description :
-------------
When creating a new AttributesImpl instance and calling on it the method setAttributes(atts) with an attributes object that has NO attributes values, then the method addAttributes() go into an infinite loop.
Explanation :
-------------
Calling the setAttributes(atts) with atts.getLength() equals to zero creates a internal 'data' object of type String[0], which length is used later in the ensureCapacity() method :
...
int max = data.length;
...
while (max < n * 5) {
max *= 2; <------- Here it hurts : max = 0 ALWAYS !!!
}
...
BUG FIX :
---------
So a fix should be to replace the beginning of the ensureCapacity method.
WAS :
private void ensureCapacity (int n)
{
if (n > 0 && data == null ) {
data = new String[25];
}
...
SHOULD BE :
private void ensureCapacity (int n)
{
if (n > 0 && (data == null || data.length == 0) ) {
data = new String[25];
}
...
Regards,
Sebastien Sahuc
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
| RSS 2.0 |
 |
| Atom 0.3 |
 |
| |
Stylus Studio has published XML-DEV in RSS and ATOM formats,
enabling users to easily subcribe to the list from their preferred news reader application.
|
Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website.
they were not included by the author in the initial post. To view the content without the Sponsor Links please
click here.
|
|