MCPcopy Create free account
hub / github.com/cedar-policy/cedar-java / parse_policy_internal

Function parse_policy_internal

CedarJavaFFI/src/interface.rs:603–620  ·  view source on GitHub ↗
(
    env: &mut JNIEnv<'a>,
    policy_jstr: JString<'a>,
)

Source from the content-addressed store, hash-verified

601}
602
603fn parse_policy_internal<'a>(
604 env: &mut JNIEnv<'a>,
605 policy_jstr: JString<'a>,
606) -> Result<JValueOwned<'a>> {
607 if policy_jstr.is_null() {
608 raise_npe(env)
609 } else {
610 let policy_jstring = env.get_string(&policy_jstr)?;
611 let policy_string = String::from(policy_jstring);
612 match Policy::from_str(&policy_string) {
613 Err(e) => Err(Box::new(e)),
614 Ok(p) => {
615 let policy_text = format!("{}", p);
616 Ok(JValueGen::Object(env.new_string(&policy_text)?.into()))
617 }
618 }
619 }
620}
621
622#[jni_fn("com.cedarpolicy.model.policy.PolicySet")]
623pub fn policySetToJson<'a>(mut env: JNIEnv<'a>, _: JClass, policies_jstr: JString<'a>) -> jvalue {

Callers 3

parsePolicyJniFunction · 0.85

Calls 2

raise_npeFunction · 0.85
ObjectInterface · 0.85

Tested by 2