summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/java/jvpp-core
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-10-16 12:33:12 +0200
committerDave Wallace <dwallacelf@gmail.com>2017-10-16 14:18:09 +0000
commitc7fc97ad85993956a5e76c2ea69dbd90b34360ac (patch)
tree34dcf0074b5c6b1f95e742af767f28bc9986f507 /src/vpp-api/java/jvpp-core
parentf90813d64c4d1aee3a51609e85e632b1f9a37536 (diff)
jvpp: stop plugin intialization on first mismatch
Java bindings use get_message_id from jvpp-common to detect if messages known at compile time are avaliable at runtime. In case of missing entry, Java exception is propagated via JNI using (*env)->ThrowNew. But this function does not end code execution so, in order to prevent unexpected behaviour (e.g. calling vl_msg_api_set_handlers with id == 0), get_message_id caller should do it manually. Change-Id: I2edb5013fd3658dcdd77a867b5cdf62e559ee071 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'src/vpp-api/java/jvpp-core')
-rw-r--r--src/vpp-api/java/jvpp-core/jvpp_core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vpp-api/java/jvpp-core/jvpp_core.c b/src/vpp-api/java/jvpp-core/jvpp_core.c
index e57c62a3e9f..b12f63af16f 100644
--- a/src/vpp-api/java/jvpp-core/jvpp_core.c
+++ b/src/vpp-api/java/jvpp-core/jvpp_core.c
@@ -55,9 +55,9 @@ JNIEXPORT void JNICALL Java_io_fd_vpp_jvpp_core_JVppCoreImpl_init0
plugin_main->callbackObject = (*env)->NewGlobalRef(env, callback);
plugin_main->callbackClass = (jclass)(*env)->NewGlobalRef(env, (*env)->GetObjectClass(env, callback));
- // verify API has not changed since jar generation
+ // verify API has not changed since jar generation (exit on mismatch)
#define _(N) \
- get_message_id(env, #N); \
+ if (get_message_id(env, #N) == 0) return;
foreach_supported_api_message;
#undef _