prims.cc (_Jv_Abort): Always print error message using fprintf, don't try to allocate.
* prims.cc (_Jv_Abort): Always print error message using fprintf, don't try to allocate. (_Jv_CreateJavaVM): Set gcj::runTimeInitialized. * include/jvm.h (gcj::runTimeInitialized): New variable declaration. * java/lang/natClassLoader.cc (_Jv_RegisterClassHookDefault): Handle duplicate class registration with JvFail if the runtime hasn't been initialized yet. From-SVN: r46424
This commit is contained in:
parent
187e37f9a6
commit
afb2dec526
4 changed files with 30 additions and 9 deletions
|
@ -14,6 +14,7 @@ details. */
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <gcj/cni.h>
|
||||
#include <jvm.h>
|
||||
|
@ -452,7 +453,17 @@ _Jv_RegisterClassHookDefault (jclass klass)
|
|||
{
|
||||
// If you get this, it means you have the same class in two
|
||||
// different libraries.
|
||||
throw new java::lang::VirtualMachineError (JvNewStringLatin1 ("class registered twice"));
|
||||
char *message;
|
||||
asprintf (&message, "Duplicate class registration: %s",
|
||||
klass->name->data);
|
||||
if (! gcj::runtimeInitialized)
|
||||
JvFail (message);
|
||||
else
|
||||
{
|
||||
java::lang::String *str = JvNewStringLatin1 (message);
|
||||
free (message);
|
||||
throw new java::lang::VirtualMachineError (str);
|
||||
}
|
||||
}
|
||||
|
||||
check_class = check_class->next;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue