@@ -355,6 +355,7 @@ void AddToBundle(JNIEnv* env, jobject bundle, const char* key, int64_t value) {
355355 env->DeleteLocalRef (key_string);
356356}
357357
358+ // Add an ArrayList to the given Bundle.
358359void AddArrayListToBundle (JNIEnv* env, jobject bundle, const char * key,
359360 jobject arraylist) {
360361 jstring key_string = env->NewStringUTF (key);
@@ -365,6 +366,7 @@ void AddArrayListToBundle(JNIEnv* env, jobject bundle, const char* key,
365366 env->DeleteLocalRef (key_string);
366367}
367368
369+ // Add a Bundle to the given Bundle.
368370void AddBundleToBundle (JNIEnv* env, jobject bundle, const char * key,
369371 jobject inner_bundle) {
370372 jstring key_string = env->NewStringUTF (key);
@@ -375,8 +377,11 @@ void AddBundleToBundle(JNIEnv* env, jobject bundle, const char* key,
375377 env->DeleteLocalRef (key_string);
376378}
377379
380+ // Declared here so that it can be used, defined below.
378381jobject MapToBundle (JNIEnv* env, const std::map<Variant, Variant>& map);
379382
383+ // Converts the given vector into a Java ArrayList. It is up to the
384+ // caller to delete the local reference when done.
380385jobject VectorToArrayList (JNIEnv* env, const std::vector<Variant>& vector) {
381386 jobject arraylist = env->NewObject (
382387 util::array_list::GetClass (),
@@ -388,6 +393,7 @@ jobject VectorToArrayList(JNIEnv* env, const std::vector<Variant>& vector) {
388393 env->CallBooleanMethod (
389394 arraylist, util::array_list::GetMethodId (util::array_list::kAdd ),
390395 bundle);
396+ util::CheckAndClearJniExceptions (env);
391397 env->DeleteLocalRef (bundle);
392398 } else {
393399 LogError (" VectorToArrayList: Unsupported type (%s) within vector." ,
@@ -397,6 +403,7 @@ jobject VectorToArrayList(JNIEnv* env, const std::vector<Variant>& vector) {
397403 return arraylist;
398404}
399405
406+ // Converts and adds the Variant to the given Bundle.
400407bool AddVariantToBundle (JNIEnv* env, jobject bundle, const char * key,
401408 const Variant& value) {
402409 if (value.is_int64 ()) {
@@ -428,6 +435,8 @@ bool AddVariantToBundle(JNIEnv* env, jobject bundle, const char* key,
428435 return true ;
429436}
430437
438+ // Converts the given map into a Java Bundle. It is up to the caller
439+ // to delete the local reference when done.
431440jobject MapToBundle (JNIEnv* env, const std::map<Variant, Variant>& map) {
432441 jobject bundle =
433442 env->NewObject (util::bundle::GetClass (),
0 commit comments