harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "spark shen (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-4321) [classlib][java6][beans] Current java6 bean implementation does not persist some class properly
Date Tue, 03 Jul 2007 10:51:04 GMT
[classlib][java6][beans] Current java6 bean implementation does not persist some class properly
-----------------------------------------------------------------------------------------------

                 Key: HARMONY-4321
                 URL: https://issues.apache.org/jira/browse/HARMONY-4321
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: spark shen


class Bar {
		public int value;
		public void barTalk() {
			System.out.println("Bar is coming!");
		}
	}
public void test_writeObject_java_lang_reflect_Field()
			throws SecurityException, NoSuchFieldException {
		ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
		XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(
				byteArrayOutputStream));
		Field value = Bar.class.getField("value");

		encoder.writeObject(value);
		encoder.close();
		DataInputStream stream = new DataInputStream(new ByteArrayInputStream(
				byteArrayOutputStream.toByteArray()));
		XMLDecoder decoder = new XMLDecoder(stream);
		Field field = (Field) decoder.readObject();
		assertEquals(value, field);
		assertEquals(value.getName(), field.getName());
}

Test result:
Harmony-branch-java6:
class java.lang.NullPointerException: newInstance is null
org.xml.sax.SAXException: No constructor for class java.lang.reflect.Field found
        at org.apache.harmony.beans.Handler.endElement(Handler.java:113)
        at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(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:77)
        at org.apache.harmony.beans.tests.java.beans.PersistenceDelegateTest.test_writeObject_java_lang_reflect_Field(PersistenceDelegateTest.java:266)
        at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:207)
        at java.lang.reflect.Method.invoke(Method.java:258)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:297)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:672)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:567)
Caused by: java.lang.NoSuchMethodException: No constructor for class java.lang.reflect.Field
found
        at java.beans.Statement.findConstructor(Statement.java:242)
        at java.beans.Statement.invokeMethod(Statement.java:122)
        at java.beans.Expression.getValue(Expression.java:71)
        at org.apache.harmony.beans.Command.doRun(Command.java:273)
        at org.apache.harmony.beans.Command.exec(Command.java:162)
        at org.apache.harmony.beans.Handler.endElement(Handler.java:111)
        ... 24 more
RI:
successful

I suspect there are still other classes not properly handle by XMLEncoder. I am trying to
implement them.

-- 
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