harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexei Zakharov (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (HARMONY-1890) [classlib][beans] java.beans.XMLDecoder.readObject() throws unexpected ArrayIndexOutOfBoundsException
Date Thu, 21 Jun 2007 21:44:27 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-1890?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Alexei Zakharov resolved HARMONY-1890.
--------------------------------------

    Resolution: Fixed

Svetlana, I've committed the fix for this issue at r549619. Please verify that it fixes the
problem mentioned above. Thanks.

> [classlib][beans] java.beans.XMLDecoder.readObject() throws unexpected ArrayIndexOutOfBoundsException
> -----------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1890
>                 URL: https://issues.apache.org/jira/browse/HARMONY-1890
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Svetlana Samoilenko
>            Assignee: Alexei Zakharov
>
> 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() {
>         return new String[10];
>     }
> }
> 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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message