// // Exception audit: // // Verdict // Exception wrapping is required. // // Rationale // `java.util.Map.put(K, V)` throws a number of exceptions, see: // // https://developer.android.com/reference/java/util/Map#put(K,%20V) // internal void Put (object key, object value) { if (id_put == IntPtr.Zero) id_put = JNIEnv.GetMethodID (map_class, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); IntPtr r = JavaConvert.WithLocalJniHandle (key, lrefKey => JavaConvert.WithLocalJniHandle (value, lrefValue => { try { return JNIEnv.CallObjectMethod (Handle, id_put, new JValue (lrefKey), new JValue (lrefValue)); } catch (Java.Lang.UnsupportedOperationException ex) when (JNIEnv.ShouldWrapJavaException (ex)) { throw new NotSupportedException (ex.Message, ex); } catch (Java.Lang.ClassCastException ex) when (JNIEnv.ShouldWrapJavaException (ex)) { throw new InvalidCastException (ex.Message, ex); } catch (Java.Lang.NullPointerException ex) when (JNIEnv.ShouldWrapJavaException (ex)) { throw new NullReferenceException (ex.Message, ex); } catch (Java.Lang.IllegalArgumentException ex) when (JNIEnv.ShouldWrapJavaException (ex)) { throw new ArgumentException (ex.Message, ex); } } ) ); JNIEnv.DeleteLocalRef (r); }