mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 13:05:53 +08:00
Fix: propagate preload/init failure from JNI init entry
Java_cn_xiaozhou233_juiceagent_api_JuiceAgent_init now checks the return values of Agent::preload and Agent::init and returns JNI_FALSE when either fails, instead of always reporting success to Java.
This commit is contained in:
1 parent
4f433bc6ee
commit
27abc2bf6a
1 file changed
+8
-2
@@ -44,8 +44,14 @@ JNIEXPORT jboolean JNICALL Java_cn_xiaozhou233_juiceagent_api_JuiceAgent_init
|
||||
|
||||
// Invoke EntryPoint
|
||||
JuiceAgent::Agent& agent = JuiceAgent::Agent::getInstance();
|
||||
agent.preload(jvm, env, jvmti, runtime_dir);
|
||||
agent.init();
|
||||
if (!agent.preload(jvm, env, jvmti, runtime_dir)) {
|
||||
spdlog::error("Failed to preload JuiceAgent");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
if (!agent.init()) {
|
||||
spdlog::error("Failed to init JuiceAgent");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
return JNI_TRUE;
|
||||
}
|
||||
Reference in new issue
Block a user