natClassLoader.cc (_Jv_UnregisterClass): Handle case where class' name is NULL.
* java/lang/natClassLoader.cc (_Jv_UnregisterClass): Handle case where class' name is NULL. (_Jv_FindClass): Don't wait for class state. * java/lang/natVMClassLoader.cc (defineClass): Only unregister if name found. * include/java-interp.h (_Jv_DefineClass): Updated. * defineclass.cc (_Jv_DefineClass): Added 'name_result' argument. (struct _Jv_ClassReader): Likewise. (found_name): New field. (handleClassBegin): Set *found_name. (_Jv_VerifyMethodSignature): Handle case where ptr==NULL. (handleClassBegin): Throw error if super class not set. (read_methods): Correctly call check_tag and prepare_pool_entry. From-SVN: r101301
This commit is contained in:
@@ -107,6 +107,10 @@ _Jv_FindClassInCache (_Jv_Utf8Const *name)
|
||||
void
|
||||
_Jv_UnregisterClass (jclass the_class)
|
||||
{
|
||||
// This can happen if the class could not be defined properly.
|
||||
if (! the_class->name)
|
||||
return;
|
||||
|
||||
JvSynchronize sync (&java::lang::Class::class$);
|
||||
jint hash = HASH_UTF(the_class->name);
|
||||
|
||||
@@ -328,12 +332,6 @@ _Jv_FindClass (_Jv_Utf8Const *name, java::lang::ClassLoader *loader)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// We need classes to be in the hash while we're loading, so
|
||||
// that they can refer to themselves.
|
||||
_Jv_Linker::wait_for_state (klass, JV_STATE_LOADED);
|
||||
}
|
||||
|
||||
return klass;
|
||||
}
|
||||
|
||||
@@ -71,16 +71,18 @@ java::lang::VMClassLoader::defineClass (java::lang::ClassLoader *loader,
|
||||
klass->name = name2;
|
||||
}
|
||||
|
||||
_Jv_Utf8Const *found_name = NULL;
|
||||
try
|
||||
{
|
||||
_Jv_DefineClass (klass, data, offset, length, pd);
|
||||
_Jv_DefineClass (klass, data, offset, length, pd, &found_name);
|
||||
}
|
||||
catch (java::lang::Throwable *ex)
|
||||
{
|
||||
klass->state = JV_STATE_ERROR;
|
||||
klass->notifyAll ();
|
||||
|
||||
_Jv_UnregisterInitiatingLoader (klass, klass->loader);
|
||||
if (found_name != NULL)
|
||||
_Jv_UnregisterInitiatingLoader (klass, klass->loader);
|
||||
|
||||
// If EX is not a ClassNotFoundException, that's ok, because we
|
||||
// account for the possibility in defineClass().
|
||||
|
||||
Reference in New Issue
Block a user