Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
Description:
Static method GeneratingBeans.array_string_empty() is written to the output via java.beans.XMLEncoder.writeObj(obj) method.
XMLDecoder.readObj() throws unexpected ArrayIndexOutOfBoundsException on attempt to read this object.
Test for reproducing:
import junit.framework.TestCase;
import java.beans.XMLDecoder;
import java.beans.XMLEncoder;
import java.io.ByteArrayOutputStream;
import java.io.ByteArrayInputStream;
import java.lang.reflect.InvocationTargetException;
public class test extends TestCase {
public void testreadObject() throws InvocationTargetException,NoSuchMethodException, IllegalAccessException
{ ByteArrayOutputStream out = new ByteArrayOutputStream(); XMLEncoder encoder = new XMLEncoder(out); Object obj = (GeneratingBeans.class.getDeclaredMethod("array_string_empty", null)).invoke(null, null); encoder.writeObject(obj); encoder.close(); new XMLDecoder(new ByteArrayInputStream(out.toByteArray())).readObject(); }
}
class GeneratingBeans {
static String[] array_string_empty()
}
HARMONY output:
==============
Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r453981, (Oct 9 2006), Windows/ia32/msvc 1310, release build http://incubator.apache.org/harmony
.java.lang.NoSuchMethodException: No constructor for class [Ljava.lang.String; found
at org.apache.harmony.beans.Handler.endElement(Handler.java:114)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at java.beans.XMLDecoder.initialize(XMLDecoder.java:128)
at java.beans.XMLDecoder.readObject(XMLDecoder.java:76)
at test.testreadObject(test.java:19)
at java.lang.reflect.VMReflection.invokeMethod(Native Method)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:107)
at junit.framework.TestResult.runProtected(TestResult.java:135)
at junit.framework.TestResult.run(TestResult.java:104)
at junit.framework.TestCase.run(TestCase.java:119)
at junit.framework.TestSuite.runTest(TestSuite.java:209)
at junit.framework.TestSuite.run(TestSuite.java:202)
at junit.textui.TestRunner.doRun(TestRunner.java:115)
at junit.textui.TestRunner.start(TestRunner.java:171)
at junit.textui.TestRunner.main(TestRunner.java:136)
E
Time: 0.329
There was 1 error:
1) testreadObject(test)java.lang.ArrayIndexOutOfBoundsException
at java.beans.XMLDecoder.readObject(XMLDecoder.java:81)
at test.testreadObject(test.java:19)
at java.lang.reflect.VMReflection.invokeMethod(Native Method)
FAILURES!!!
Tests run: 1, Failures: 0, Errors: 1
SUN output:
==========
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
.
Time: 0.047
OK (1 test
Attachments
Issue Links
- blocks
-
HARMONY-4107 [M2] umbrella task for 98% pass rate of Functional test suite - HARMONY-3528; no regression since M1
- Closed