8220355: Improve assertion texts and exception messages in eventHandlerVMInit
Reviewed-by: alanb, sspitsyn, jcbeyler
This commit is contained in:
parent
dc7b3e8df3
commit
3b0ae8082a
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -558,7 +558,9 @@ eventHandlerVMInit( jvmtiEnv * jvmtienv,
|
|||||||
environment = getJPLISEnvironment(jvmtienv);
|
environment = getJPLISEnvironment(jvmtienv);
|
||||||
|
|
||||||
/* process the premain calls on the all the JPL agents */
|
/* process the premain calls on the all the JPL agents */
|
||||||
if ( environment != NULL ) {
|
if (environment == NULL) {
|
||||||
|
abortJVM(jnienv, JPLIS_ERRORMESSAGE_CANNOTSTART ", getting JPLIS environment failed");
|
||||||
|
}
|
||||||
jthrowable outstandingException = NULL;
|
jthrowable outstandingException = NULL;
|
||||||
/*
|
/*
|
||||||
* Add the jarfile to the system class path
|
* Add the jarfile to the system class path
|
||||||
@ -570,20 +572,18 @@ eventHandlerVMInit( jvmtiEnv * jvmtienv,
|
|||||||
"appendToClassPathForInstrumentation method or the method failed\n",
|
"appendToClassPathForInstrumentation method or the method failed\n",
|
||||||
agent->mJarfile);
|
agent->mJarfile);
|
||||||
free((void *)agent->mJarfile);
|
free((void *)agent->mJarfile);
|
||||||
abortJVM(jnienv, JPLIS_ERRORMESSAGE_CANNOTSTART);
|
abortJVM(jnienv, JPLIS_ERRORMESSAGE_CANNOTSTART ", appending to system class path failed");
|
||||||
}
|
}
|
||||||
free((void *)agent->mJarfile);
|
free((void *)agent->mJarfile);
|
||||||
agent->mJarfile = NULL;
|
agent->mJarfile = NULL;
|
||||||
|
|
||||||
outstandingException = preserveThrowable(jnienv);
|
outstandingException = preserveThrowable(jnienv);
|
||||||
success = processJavaStart( environment->mAgent,
|
success = processJavaStart( environment->mAgent, jnienv);
|
||||||
jnienv);
|
|
||||||
restoreThrowable(jnienv, outstandingException);
|
restoreThrowable(jnienv, outstandingException);
|
||||||
}
|
|
||||||
|
|
||||||
/* if we fail to start cleanly, bring down the JVM */
|
/* if we fail to start cleanly, bring down the JVM */
|
||||||
if ( !success ) {
|
if ( !success ) {
|
||||||
abortJVM(jnienv, JPLIS_ERRORMESSAGE_CANNOTSTART);
|
abortJVM(jnienv, JPLIS_ERRORMESSAGE_CANNOTSTART ", processJavaStart failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -389,17 +389,17 @@ processJavaStart( JPLISAgent * agent,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First make our emergency fallback InternalError throwable.
|
* First make our fallback InternalError throwable.
|
||||||
*/
|
*/
|
||||||
result = initializeFallbackError(jnienv);
|
result = initializeFallbackError(jnienv);
|
||||||
jplis_assert(result);
|
jplis_assert_msg(result, "fallback init failed");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now make the InstrumentationImpl instance.
|
* Now make the InstrumentationImpl instance.
|
||||||
*/
|
*/
|
||||||
if ( result ) {
|
if ( result ) {
|
||||||
result = createInstrumentationImpl(jnienv, agent);
|
result = createInstrumentationImpl(jnienv, agent);
|
||||||
jplis_assert(result);
|
jplis_assert_msg(result, "instrumentation instance creation failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -409,7 +409,7 @@ processJavaStart( JPLISAgent * agent,
|
|||||||
*/
|
*/
|
||||||
if ( result ) {
|
if ( result ) {
|
||||||
result = setLivePhaseEventHandlers(agent);
|
result = setLivePhaseEventHandlers(agent);
|
||||||
jplis_assert(result);
|
jplis_assert_msg(result, "setting of live phase VM handlers failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -419,6 +419,7 @@ processJavaStart( JPLISAgent * agent,
|
|||||||
result = startJavaAgent(agent, jnienv,
|
result = startJavaAgent(agent, jnienv,
|
||||||
agent->mAgentClassName, agent->mOptionsString,
|
agent->mAgentClassName, agent->mOptionsString,
|
||||||
agent->mPremainCaller);
|
agent->mPremainCaller);
|
||||||
|
jplis_assert_msg(result, "agent load/premain call failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user