@@ -355,6 +355,7 @@ void AddToBundle(JNIEnv* env, jobject bundle, const char* key, int64_t value) {
355
355
env->DeleteLocalRef (key_string);
356
356
}
357
357
358
+ // Add an ArrayList to the given Bundle.
358
359
void AddArrayListToBundle (JNIEnv* env, jobject bundle, const char * key,
359
360
jobject arraylist) {
360
361
jstring key_string = env->NewStringUTF (key);
@@ -365,6 +366,7 @@ void AddArrayListToBundle(JNIEnv* env, jobject bundle, const char* key,
365
366
env->DeleteLocalRef (key_string);
366
367
}
367
368
369
+ // Add a Bundle to the given Bundle.
368
370
void AddBundleToBundle (JNIEnv* env, jobject bundle, const char * key,
369
371
jobject inner_bundle) {
370
372
jstring key_string = env->NewStringUTF (key);
@@ -375,8 +377,11 @@ void AddBundleToBundle(JNIEnv* env, jobject bundle, const char* key,
375
377
env->DeleteLocalRef (key_string);
376
378
}
377
379
380
+ // Declared here so that it can be used, defined below.
378
381
jobject MapToBundle (JNIEnv* env, const std::map<Variant, Variant>& map);
379
382
383
+ // Converts the given vector into a Java ArrayList. It is up to the
384
+ // caller to delete the local reference when done.
380
385
jobject VectorToArrayList (JNIEnv* env, const std::vector<Variant>& vector) {
381
386
jobject arraylist = env->NewObject (
382
387
util::array_list::GetClass (),
@@ -388,6 +393,7 @@ jobject VectorToArrayList(JNIEnv* env, const std::vector<Variant>& vector) {
388
393
env->CallBooleanMethod (
389
394
arraylist, util::array_list::GetMethodId (util::array_list::kAdd ),
390
395
bundle);
396
+ util::CheckAndClearJniExceptions (env);
391
397
env->DeleteLocalRef (bundle);
392
398
} else {
393
399
LogError (" VectorToArrayList: Unsupported type (%s) within vector." ,
@@ -397,6 +403,7 @@ jobject VectorToArrayList(JNIEnv* env, const std::vector<Variant>& vector) {
397
403
return arraylist;
398
404
}
399
405
406
+ // Converts and adds the Variant to the given Bundle.
400
407
bool AddVariantToBundle (JNIEnv* env, jobject bundle, const char * key,
401
408
const Variant& value) {
402
409
if (value.is_int64 ()) {
@@ -428,6 +435,8 @@ bool AddVariantToBundle(JNIEnv* env, jobject bundle, const char* key,
428
435
return true ;
429
436
}
430
437
438
+ // Converts the given map into a Java Bundle. It is up to the caller
439
+ // to delete the local reference when done.
431
440
jobject MapToBundle (JNIEnv* env, const std::map<Variant, Variant>& map) {
432
441
jobject bundle =
433
442
env->NewObject (util::bundle::GetClass (),
0 commit comments