I've added additional test case to this test:
static class Tmp implements Serializable {}
private ArrayList l = new ArrayList();
public void test() throws IOException {
l.add(new Tmp());
ByteArrayOutputStream byteStream = new
ByteArrayOutputStream(512);
ObjectOutputStream oos = new ObjectOutputStream(byteStream);
oos.writeObject(l);
oos.flush();
oos.close();
}
This test case also fails with the same error:
java.lang.NullPointerException
at
java.io.ObjectStreamClass.buildFieldDescriptors(ObjectStreamClass.java:3
22)
at java.io.ObjectStreamClass.createClassDesc(ObjectStreamClass.java:229)
at
java.io.ObjectStreamClass.lookupStreamClass(ObjectStreamClass.java:907)
at
java.io.ObjectStreamClass.lookupStreamClass(ObjectStreamClass.java:884)
at
java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1
844)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1770)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1734)
at
org.apache.harmony.awt.ListenerListTest.test(ListenerListTest.java:44)
at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
So, it seems to be not AWT issue. The NPE happens because the method
java.io.ObjectStreamField.getType() sometimes returns null. This happens
intermittent and only when I run the test in batch with other AWT tests.
The null value of the field type appears in the method
ObjectStreamField.getTypeInternal() which extracts the type from a weak
reference. See the following code:
--- ObjectStreamField.java ---
private Class<?> getTypeInternal() {
if (type instanceof WeakReference) {
return (Class<?>) ((WeakReference<?>) type).get(); <-- !!!
}
return (Class<?>) type;
}
public Class<?> getType() {
Class<?> cl = getTypeInternal();
if (isDeserialized && !cl.isPrimitive()) {
return Object.class;
}
return cl;
}
--------------------
Could somebody take a look at this issue?
-----Original Message-----
From: Pavlenko, Andrey A [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 28, 2007 5:40 PM
To: [email protected]
Subject: RE: [classlib][awt] test
org.apache.harmony.awt.ListenerListTest failed on Linux x86_64
I used debug. I reproduced the failure on release build.
Now I can reproduce the failure only using release build and only
running this test in a batch with all AWT tests, but in standalone mode
this test passes.
-----Original Message-----
From: Alexei Zakharov [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 28, 2007 4:56 PM
To: [email protected]
Subject: Re: [classlib][awt] test
org.apache.harmony.awt.ListenerListTest failed on Linux x86_64
Andrey,
Do you use the release version of classlib & DRLVM builds? Or debug?
Regards,
2007/6/28, Pavlenko, Andrey A <[EMAIL PROTECTED]>:
> Vladimir,
>
> I can't reproduce this failure on SLES9 x86_64.
>
> -----Original Message-----
> From: Vladimir Ivanov [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 22, 2007 10:21 AM
> To: dev
> Subject: [classlib][awt] test org.apache.harmony.awt.ListenerListTest
> failed on Linux x86_64
>
> Classlib test org.apache.harmony.awt.ListenerListTest failed DRLVM on
> Linux x86_64 with execution log:
> -------------------------------------------------------------------
> org.apache.harmony.awt.ListenerListTest
> java.lang.NullPointerException
> at
>
java.io.ObjectStreamClass.buildFieldDescriptors(ObjectStreamClass.java:3
> 22)
> at
> java.io.ObjectStreamClass.createClassDesc(ObjectStreamClass.java:229)
> at
>
java.io.ObjectStreamClass.lookupStreamClass(ObjectStreamClass.java:907)
> at
>
java.io.ObjectStreamClass.lookupStreamClass(ObjectStreamClass.java:884)
> at
>
java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1
> 848)
> at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1774)
> at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1738)
> at
> org.apache.harmony.awt.ListenerList.writeObject(ListenerList.java:180)
> at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
> at
>
java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1305)
> at
>
java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1663)
> at
>
java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1
> 931)
> at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1774)
> at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1738)
> at
>
org.apache.harmony.awt.ListenerListTest.writeAndRead(ListenerListTest.ja
> va:57)
> at
>
org.apache.harmony.awt.ListenerListTest.testSerialize(ListenerListTest.j
> ava:46)
> at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
> ---------------------------------------------
>
> Could someone take care about this issue?
> thanks, Vladimir
>
--
Alexei Zakharov,
Intel ESSD