-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta2
-
sparc
-
solaris_2.6
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)
%
======================================================================
- relates to
-
JDK-4474332 RFE: LTP: no way of knowing if the ObjectStream is empty
-
- Closed
-