[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: hasClassInitializer and exception
From: |
Archie Cobbs |
Subject: |
Re: hasClassInitializer and exception |
Date: |
Thu, 21 Jul 2005 11:59:41 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041129 |
Nicolas Geoffray wrote:
there is something that might be wrong in the implementation of
VMObjectStreamClass.hasClassInitializer
(native/jni/java-io/java_io_VMObjectStreamClass.c). It uses
GetStaticMethodID and tests if an exception occured to see if the clinit
method exists.
The thing is, in the spec, GetStaticMethodID has to clinit the class.
Imagine there is a clinit and the clinit raises and exception, the
result of hasClassInitializer would be false.
How about this: add this line to ObjectStreamClass before calling
VMObjectStreamClass.hasClassInitializer to force class initialization
ahead of time:
Class.forName(cl.getName(), true, cl.getClassLoader());
Then we'll know that any exception thrown in the JNI code is
not an initializer exception.
-Archie
__________________________________________________________________________
Archie Cobbs * CTO, Awarix * http://www.awarix.com