| 878 | } |
| 879 | |
| 880 | fn template_effect_jni_internal<'a>( |
| 881 | env: &mut JNIEnv<'a>, |
| 882 | policy_jstr: JString<'a>, |
| 883 | ) -> Result<JValueOwned<'a>> { |
| 884 | if policy_jstr.is_null() { |
| 885 | raise_npe(env) |
| 886 | } else { |
| 887 | let policy_jstring = env.get_string(&policy_jstr)?; |
| 888 | let policy_string = String::from(policy_jstring); |
| 889 | let policy = Template::from_str(&policy_string)?; |
| 890 | let policy_effect = policy.effect().to_string(); |
| 891 | Ok(JValueGen::Object(env.new_string(&policy_effect)?.into())) |
| 892 | } |
| 893 | } |
| 894 | |
| 895 | #[jni_fn("com.cedarpolicy.model.policy.Policy")] |
| 896 | pub fn fromJsonJni<'a>(mut env: JNIEnv<'a>, _: JClass, policy_json_jstr: JString<'a>) -> jvalue { |