/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.policy.assertion.AssertionStatus
 *  com.l7tech.policy.assertion.PolicyAssertionException
 *  com.l7tech.util.Eithers
 *  com.l7tech.util.Eithers$E2
 *  com.l7tech.util.Functions$Nullary
 */
package com.l7tech.server.policy;

import com.l7tech.policy.assertion.AssertionStatus;
import com.l7tech.policy.assertion.PolicyAssertionException;
import com.l7tech.server.message.PolicyEnforcementContext;
import com.l7tech.server.policy.PolicyMetadata;
import com.l7tech.server.policy.ServerPolicy;
import com.l7tech.server.policy.ServerPolicyHandle;
import com.l7tech.util.Eithers;
import com.l7tech.util.Functions;
import java.io.IOException;

class ao
implements Functions.Nullary<Eithers.E2<PolicyAssertionException, IOException, AssertionStatus>> {
    final PolicyEnforcementContext val$context;
    final ServerPolicy val$target;
    final ServerPolicyHandle this$0;

    /*
     * Ignored method signature, as it can't be verified against descriptor
     */
    ao(ServerPolicyHandle serverPolicyHandle, PolicyEnforcementContext policyEnforcementContext, ServerPolicy serverPolicy) {
        this.this$0 = serverPolicyHandle;
        this.val$context = policyEnforcementContext;
        this.val$target = serverPolicy;
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     * Loose catch block
     */
    public Eithers.E2<PolicyAssertionException, IOException, AssertionStatus> call() {
        PolicyMetadata policyMetadata;
        try {
            policyMetadata = this.val$context == null ? null : this.val$context.getCurrentPolicyMetadata();
        }
        catch (PolicyAssertionException policyAssertionException) {
            throw ao.a(policyAssertionException);
        }
        PolicyMetadata policyMetadata2 = policyMetadata;
        try {
            if (this.val$context != null) {
                this.val$context.setCurrentPolicyMetadata(this.this$0.c);
            }
        }
        catch (PolicyAssertionException policyAssertionException) {
            throw ao.a(policyAssertionException);
        }
        Eithers.E2 e22 = Eithers.right2((Object)this.val$target.checkRequest(this.val$context));
        try {
            if (this.val$context != null) {
                this.val$context.setCurrentPolicyMetadata(policyMetadata2);
            }
        }
        catch (PolicyAssertionException policyAssertionException) {
            throw ao.a(policyAssertionException);
        }
        return e22;
        catch (PolicyAssertionException policyAssertionException) {
            Eithers.E2 e23 = Eithers.left2_1((Object)((Object)policyAssertionException));
            try {
                if (this.val$context != null) {
                    this.val$context.setCurrentPolicyMetadata(policyMetadata2);
                }
            }
            catch (PolicyAssertionException policyAssertionException2) {
                throw ao.a(policyAssertionException2);
            }
            return e23;
        }
        catch (IOException iOException) {
            Eithers.E2 e24 = Eithers.left2_2((Object)iOException);
            {
                catch (Throwable throwable) {
                    try {
                        if (this.val$context != null) {
                            this.val$context.setCurrentPolicyMetadata(policyMetadata2);
                        }
                    }
                    catch (PolicyAssertionException policyAssertionException) {
                        throw ao.a(policyAssertionException);
                    }
                    throw throwable;
                }
            }
            try {
                if (this.val$context != null) {
                    this.val$context.setCurrentPolicyMetadata(policyMetadata2);
                }
            }
            catch (PolicyAssertionException policyAssertionException) {
                throw ao.a(policyAssertionException);
            }
            return e24;
        }
    }

    private static PolicyAssertionException a(PolicyAssertionException policyAssertionException) {
        return policyAssertionException;
    }
}

