| 855 | } |
| 856 | |
| 857 | fn policy_effect_jni_internal<'a>( |
| 858 | env: &mut JNIEnv<'a>, |
| 859 | policy_jstr: JString<'a>, |
| 860 | ) -> Result<JValueOwned<'a>> { |
| 861 | if policy_jstr.is_null() { |
| 862 | raise_npe(env) |
| 863 | } else { |
| 864 | let policy_jstring = env.get_string(&policy_jstr)?; |
| 865 | let policy_string = String::from(policy_jstring); |
| 866 | let policy = Policy::from_str(&policy_string)?; |
| 867 | let policy_effect = policy.effect().to_string(); |
| 868 | Ok(JValueGen::Object(env.new_string(&policy_effect)?.into())) |
| 869 | } |
| 870 | } |
| 871 | |
| 872 | #[jni_fn("com.cedarpolicy.model.policy.Policy")] |
| 873 | pub fn templateEffectJni<'a>(mut env: JNIEnv<'a>, _: JClass, policy_jstr: JString<'a>) -> jvalue { |