From 3214dc382342573c242782849d98c23009960633 Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Thu, 10 Aug 2017 14:57:42 +0200 Subject: jvpp: ignore messages if callback method is missing (VPP-548) Change-Id: I6a06dbcd8339bd6645a6b02ae70154aa0885dcf8 Signed-off-by: Marek Gradzki --- src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py index 1425cdb7a8f..7e59cc4c785 100644 --- a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py +++ b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py @@ -226,11 +226,19 @@ static void vl_api_${handler_name}_t_handler (vl_api_${handler_name}_t * mp) { ${plugin_name}_main_t *plugin_main = &${plugin_name}_main; JNIEnv *env = jvpp_main.jenv; + jthrowable exc; $err_handler jmethodID constructor = (*env)->GetMethodID(env, ${class_ref_name}Class, "", "()V"); jmethodID callbackMethod = (*env)->GetMethodID(env, plugin_main->callbackClass, "on${dto_name}", "(Lio/fd/vpp/jvpp/${plugin_name}/dto/${dto_name};)V"); + exc = (*env)->ExceptionOccurred(env); + if (exc) { + clib_warning("Unable to extract on${dto_name} method reference from ${plugin_name} plugin's callbackClass. Ignoring message.\\n"); + (*env)->ExceptionDescribe(env); + (*env)->ExceptionClear(env); + return; + } jobject dto = (*env)->NewObject(env, ${class_ref_name}Class, constructor); $dto_setters -- cgit 1.2.3-korg