FULL PRODUCT VERSION :
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
The test to determine whether to grow the specified and declared arrays is backwards. Specifically in the addAttribute method, the comparison on line 232 of the file org.xml.sax.ext.Attributes2Impl.java currently reads:
if (length < specified.length) {
This is incorrect and should be:
if (length > specified.length) {
The incorrect comparison results in the "specified" and "declared" arrays being reallocated when they do not need to be, and not being reallocated when it needs to be thereby throwing an ArrayIndexOutOfBoundsException exception in line 244.
In addition, as a performance enhancement, I would suggest reallocating in chunks larger 1.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Instantiate an Attributes2Impl object. Call its addAttribute method. See the ArrayIndexOutOfBoundsException exception get thrown.
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROND :
Create private copy of Attributes2Impl with the correct comparison.
###@###.### 2004-12-07 22:45:06 GMT
###@###.### 2005-2-01 08:36:14 GMT