Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4684119

Exception in AttributesImpl.removeAttribute()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.1
    • 1.4.1
    • xml
    • hopper
    • sparc
    • solaris_8



      Name: gm110360 Date: 05/13/2002


      FULL PRODUCT VERSION :
      java version "1.4.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
      Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)


      FULL OPERATING SYSTEM VERSION :
      Not applicable; error is OS independent.

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Problem has nothing to do with the operating
      system environment

      A DESCRIPTION OF THE PROBLEM :
      Due to an apparent logic bug in
      org.xml.sax.helpers.AttributesImpl.removeAttribute(),
      an ArrayIndexOutOfBoundException is thrown if you
      attempt to remove the first attribute of 10.




      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1.Compile and execute my testcase
      2.You will receive an ArrayIndexOutOfBoundsException


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      I expect to not get an exception.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
              at java.lang.System.arraycopy(Native Method)
              at
      org.xml.sax.helpers.AttributesImpl.removeAttribute(AttributesImpl.java:439)
              at Test.main(Test.java:15)


      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import org.xml.sax.helpers.AttributesImpl;
      class Test {
          public static void main(String args[]){
              AttributesImpl attrs = new AttributesImpl();
              attrs.addAttribute("","","A","CDATA","1");
              attrs.addAttribute("","","B","CDATA","1");
              attrs.addAttribute("","","C","CDATA","1");
              attrs.addAttribute("","","D","CDATA","1");
              attrs.addAttribute("","","E","CDATA","1");
              attrs.addAttribute("","","F","CDATA","1");
              attrs.addAttribute("","","G","CDATA","1");
              attrs.addAttribute("","","H","CDATA","1");
              attrs.addAttribute("","","I","CDATA","1");
              attrs.addAttribute("","","J","CDATA","1");
              attrs.removeAttribute(0);
              }
          }

      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      Use an alternative implementation of the Attributes
      interface.
      (Review ID: 146127)
      ======================================================================

            egoei Edwin Goei (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: