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

java.beans.XMLDecoder.readObject throws ArrayIndexOutOfBoundsException

    XMLWordPrintable

Details

    • beta2
    • sparc
    • solaris_2.6

    Description



      Name: dsR10051 Date: 03/12/2001


      The method readObject of class java.beans.XMLDecoder
      throws undocumented ArrayIndexOutOfBoundsException
      if object is not writen to stream by XMLEncoder.

      Here is minimized test:
      import java.io.ByteArrayOutputStream;
      import java.io.ByteArrayInputStream;
      import java.beans.XMLEncoder;
      import java.beans.XMLDecoder;

      public class Test0004 {

          public static void main(String[] args) {
              ByteArrayOutputStream os = new ByteArrayOutputStream();
              XMLEncoder xmlEnc = new XMLEncoder(os);
              xmlEnc.flush();
              ByteArrayInputStream in = new ByteArrayInputStream(os.toByteArray());
              XMLDecoder xmlDec = new XMLDecoder(in);

              Object res = xmlDec.readObject();
          }
      }

      --- Output ---
      %java -version
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b54)
      Java HotSpot(TM) Client VM (build 1.4beta-B54, mixed mode)
      %java Test0004
      org.xml.sax.SAXParseException: End of entity not allowed; an end tag is missing.
      Continuing ...
      Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
              at java.beans.ObjectHandler.dequeueResult(XMLDecoder.java:270)
              at java.beans.XMLDecoder.readObject(XMLDecoder.java:148)
              at Test0004.main(Test0004.java:15)
      %

      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              kwalrathsunw Kathy Walrath (Inactive)
              sdasunw Sda Sda (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: