[kaffe] Bug in java.io.NotActiveException: defaultWriteObject
called by non-active class and/or object ?
Guilhem Lavaux
guilhem at kaffe.org
Wed Jan 14 23:21:02 PST 2004
Gérard Basler wrote:
>Hi,
>
Hi Gérard,
>
>>From Sun's Java 1.4 doc:
>"This may only be called from the writeObject method of the class being
>serialized. It will throw the NotActiveException if it is called
>otherwise."
>
>I have a class with the following method:
>
>private void writeObject(java.io.ObjectOutputStream out) throws
>IOException
>{
> out.defaultWriteObject();
>}
>
>This will throw the following exception when run:
>java.io.NotActiveException: defaultWriteObject called by non-active
>class and/or object
> at java.io.ObjectOutputStream.markFieldsWritten
>(ObjectOutputStream.java:448)
> at java.io.ObjectOutputStream.defaultWriteObject
>(ObjectOutputStream.java:440)
>
>When I run without any exceptino under the Sun's vm.
>
>I took a look at the code of Kaffe's java classes and it looks like this
>doesn't happen if I call writeObject(Object obj) of
>ObjectOutputStream.java first.
>
>My question is now:
>Is this a bug or not? There doesn't seem to be any obligation to call
>writeObject(Object obj) before one can use defaultWriteObject() from
>Sun's view.
>
>
As I've understood you're trying to call your classes' writeObject
method without using ObjectOutputStream.writeObject. As you've just
quoted, it may only be called by 'class being serialized' it implies you
may only call it if your writeObject has been called by
ObjectOutputStream. So it's not a bug. BTW, I've tried to call
defaultWriteObject directly using Sun's JRE and it also fails.
Could you send more details on how you call writeObject ? (Here there
may be a flaw...)
Best regards,
Guilhem.
More information about the kaffe
mailing list