Bug 5159 - AttributesImpl.ensureCapacity() loops forever
Summary: AttributesImpl.ensureCapacity() loops forever
Status: NEW
Alias: None
Product: Xerces-J
Classification: Unclassified
Component: SAX (show other bugs)
Version: 1.4.4
Hardware: All All
: P3 normal
Target Milestone: ---
Assignee: Xerces-J Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-11-28 05:26 UTC by Johannes Hofmann
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments
A little bit more efficient patch than the one already provided (369 bytes, patch)
2002-05-24 21:58 UTC, Charles Ng
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Hofmann 2001-11-28 05:26:59 UTC
AttributesImpl initialized with empty Attributes loops forever in
ensureCapacity when adding a new Attribute.

Test Program and patch are attached.

Cheers
Johannes Hofmann




import org.xml.sax.helpers.AttributesImpl;

public class test {
    public static void main(String argv[]) {
        AttributesImpl a, b;

        a = new AttributesImpl();
        b = new AttributesImpl(a);
        b.addAttribute("", "foo", "foo", "", "bar");
    }
}






4_4/src/org/xml/sax/helpers/AttributesImpl.java
--- xerces-1_4_4_orig/src/org/xml/sax/helpers/AttributesImpl.java       Thu 
Nov 
15 20:26:47 2001
+++ xerces-1_4_4/src/org/xml/sax/helpers/AttributesImpl.java    Wed Nov 28 
14:10
:22 2001
@@ -567,6 +567,9 @@
            return;
        }
 
+       if ( max == 0 ) {
+           max = 25;
+       }
 
        while (max < n * 5) {
            max *= 2;
Comment 1 Charles Ng 2002-05-24 21:58:06 UTC
Created attachment 1932 [details]
A little bit more efficient patch than the one already provided