/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.policy.variable.NoSuchVariableException
 *  com.l7tech.util.ExceptionUtils
 *  com.l7tech.xml.xpath.NoSuchXpathVariableException
 *  com.l7tech.xml.xpath.XpathVariableFinder
 */
package com.l7tech.server.util.xml;

import com.l7tech.policy.variable.NoSuchVariableException;
import com.l7tech.server.message.PolicyEnforcementContext;
import com.l7tech.util.ExceptionUtils;
import com.l7tech.xml.xpath.NoSuchXpathVariableException;
import com.l7tech.xml.xpath.XpathVariableFinder;

public class PolicyEnforcementContextXpathVariableFinder
implements XpathVariableFinder {
    private final PolicyEnforcementContext a;
    private static final String b = PolicyEnforcementContextXpathVariableFinder.a(82, PolicyEnforcementContextXpathVariableFinder.a("hh\t\r4eTOr\u001f\u001cdMk\\r\u0012X2tITg\u0018\u0014!5U\\k\u001f\u000b4tXX<Z"));

    public PolicyEnforcementContextXpathVariableFinder(PolicyEnforcementContext policyEnforcementContext) {
        this.a = policyEnforcementContext;
    }

    /*
     * Loose catch block
     */
    public Object getVariableValue(String string, String string2) throws NoSuchXpathVariableException {
        block6: {
            if (string == null) break block6;
            try {
                block7: {
                    if (string.length() <= 0) break block6;
                    break block7;
                    catch (NoSuchVariableException noSuchVariableException) {
                        throw PolicyEnforcementContextXpathVariableFinder.a(noSuchVariableException);
                    }
                }
                throw new NoSuchXpathVariableException(b + string);
            }
            catch (NoSuchVariableException noSuchVariableException) {
                throw PolicyEnforcementContextXpathVariableFinder.a(noSuchVariableException);
            }
        }
        try {
            return this.a.getVariable(string2);
        }
        catch (NoSuchVariableException noSuchVariableException) {
            throw new NoSuchXpathVariableException(ExceptionUtils.getMessage((Throwable)noSuchVariableException), (Throwable)noSuchVariableException);
        }
    }

    private static NoSuchVariableException a(NoSuchVariableException noSuchVariableException) {
        return noSuchVariableException;
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x69);
        }
        return cArray;
    }

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String a(int n2, char[] cArray) {
        char[] cArray2;
        block11: {
            int n3;
            int n4;
            int n5;
            block10: {
                n5 = n2;
                cArray2 = cArray;
                n4 = cArray.length;
                n3 = 0;
                if (!true) break block10;
                n4 = n4;
                if (n4 <= n3) break block11;
            }
            do {
                n5 = n5;
                cArray2 = cArray2;
                int n6 = n3;
                cArray2[n6] = (char)(cArray2[n6] ^ (n5 ^ (switch (n3 % 7) {
                    case 0 -> 111;
                    case 1 -> 84;
                    case 2 -> 40;
                    case 3 -> 42;
                    case 4 -> 22;
                    case 5 -> 71;
                    default -> 105;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

