/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.audit.AssertionMessages
 *  com.l7tech.gateway.common.audit.AuditDetailMessage
 *  com.l7tech.gateway.common.audit.AuditFactory
 *  com.l7tech.kerberos.KerberosException
 *  com.l7tech.kerberos.KerberosServiceTicket
 *  com.l7tech.message.Message
 *  com.l7tech.message.SecurityKnob
 *  com.l7tech.message.TcpKnob
 *  com.l7tech.message.XmlKnob
 *  com.l7tech.policy.assertion.AssertionStatus
 *  com.l7tech.policy.assertion.RoutingAssertion
 *  com.l7tech.policy.assertion.RoutingAssertionWithSamlSV
 *  com.l7tech.policy.assertion.credential.LoginCredentials
 *  com.l7tech.security.saml.NameIdentifierInclusionType
 *  com.l7tech.security.saml.SamlAssertionGenerator
 *  com.l7tech.security.saml.SamlAssertionGenerator$Options
 *  com.l7tech.security.saml.SubjectStatement
 *  com.l7tech.security.saml.SubjectStatement$Confirmation
 *  com.l7tech.security.token.KerberosAuthenticationSecurityToken
 *  com.l7tech.security.token.KerberosSigningSecurityToken
 *  com.l7tech.security.token.XmlSecurityToken
 *  com.l7tech.security.xml.KeyInfoInclusionType
 *  com.l7tech.security.xml.SecurityActor
 *  com.l7tech.security.xml.SignerInfo
 *  com.l7tech.security.xml.decorator.WssDecoratorUtils
 *  com.l7tech.security.xml.processor.ProcessorResult
 *  com.l7tech.util.ConfigFactory
 *  com.l7tech.util.ExceptionUtils
 *  com.l7tech.util.InvalidDocumentFormatException
 *  com.l7tech.util.SoapConstants
 *  com.l7tech.xml.soap.SoapUtil
 *  org.springframework.context.ApplicationContext
 *  org.springframework.context.ApplicationEvent
 *  org.springframework.context.ApplicationEventPublisher
 */
package com.l7tech.server.policy.assertion;

import com.l7tech.gateway.common.audit.AssertionMessages;
import com.l7tech.gateway.common.audit.AuditDetailMessage;
import com.l7tech.gateway.common.audit.AuditFactory;
import com.l7tech.kerberos.KerberosException;
import com.l7tech.kerberos.KerberosServiceTicket;
import com.l7tech.message.Message;
import com.l7tech.message.SecurityKnob;
import com.l7tech.message.TcpKnob;
import com.l7tech.message.XmlKnob;
import com.l7tech.policy.assertion.AssertionStatus;
import com.l7tech.policy.assertion.RoutingAssertion;
import com.l7tech.policy.assertion.RoutingAssertionWithSamlSV;
import com.l7tech.policy.assertion.credential.LoginCredentials;
import com.l7tech.security.saml.NameIdentifierInclusionType;
import com.l7tech.security.saml.SamlAssertionGenerator;
import com.l7tech.security.saml.SubjectStatement;
import com.l7tech.security.token.KerberosAuthenticationSecurityToken;
import com.l7tech.security.token.KerberosSigningSecurityToken;
import com.l7tech.security.token.XmlSecurityToken;
import com.l7tech.security.xml.KeyInfoInclusionType;
import com.l7tech.security.xml.SecurityActor;
import com.l7tech.security.xml.SignerInfo;
import com.l7tech.security.xml.decorator.WssDecoratorUtils;
import com.l7tech.security.xml.processor.ProcessorResult;
import com.l7tech.server.event.PostRoutingEvent;
import com.l7tech.server.event.PreRoutingEvent;
import com.l7tech.server.message.AuthenticationContext;
import com.l7tech.server.message.PolicyEnforcementContext;
import com.l7tech.server.policy.assertion.AbstractServerAssertion;
import com.l7tech.server.policy.assertion.AssertionStatusException;
import com.l7tech.server.security.kerberos.KerberosRoutingClient;
import com.l7tech.server.util.EventChannel;
import com.l7tech.util.ConfigFactory;
import com.l7tech.util.ExceptionUtils;
import com.l7tech.util.InvalidDocumentFormatException;
import com.l7tech.util.SoapConstants;
import com.l7tech.xml.soap.SoapUtil;
import java.io.IOException;
import java.net.InetAddress;
import java.net.URL;
import java.net.UnknownHostException;
import java.security.SignatureException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.util.List;
import java.util.Map;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;

public abstract class ServerRoutingAssertion<RAT extends RoutingAssertion>
extends AbstractServerAssertion<RAT> {
    protected final ApplicationContext applicationContext;
    protected final ApplicationEventPublisher messageProcessingEventChannel;
    static final /* synthetic */ boolean d;
    private static final String[] L;

    protected ServerRoutingAssertion(RAT RAT, ApplicationContext applicationContext) {
        AuditFactory auditFactory;
        if (applicationContext == null) {
            auditFactory = null;
        } else {
            String[] stringArray = L;
            auditFactory = (AuditFactory)applicationContext.getBean(stringArray[10], AuditFactory.class);
        }
        super(RAT, auditFactory);
        this.applicationContext = applicationContext;
        if (applicationContext == null) {
            this.messageProcessingEventChannel = new EventChannel();
        } else {
            Object object;
            ApplicationEventPublisher applicationEventPublisher = (ApplicationEventPublisher)applicationContext.getBean(L[11], EventChannel.class);
            try {
                ServerRoutingAssertion serverRoutingAssertion = this;
                object = applicationEventPublisher != null ? applicationEventPublisher : applicationContext;
            }
            catch (AssertionStatusException assertionStatusException) {
                throw ServerRoutingAssertion.b(assertionStatusException);
            }
            serverRoutingAssertion.messageProcessingEventChannel = object;
        }
    }

    protected void handleProcessedSecurityHeader(Message message) throws SAXException, IOException {
        this.handleProcessedSecurityHeader(message, ((RoutingAssertion)this.assertion).getCurrentSecurityHeaderHandling(), ((RoutingAssertion)this.assertion).getXmlSecurityActorToPromote());
    }

    /*
     * Unable to fully structure code
     */
    protected void handleProcessedSecurityHeader(Message var1_1, int var2_2, String var3_3) throws SAXException, IOException {
        block32: {
            block31: {
                block30: {
                    try {
                        if (var2_2 == 3) {
                            return;
                        }
                    }
                    catch (InvalidDocumentFormatException v0) {
                        throw ServerRoutingAssertion.b((Exception)v0);
                    }
                    var4_4 = (XmlKnob)var1_1.getKnob(XmlKnob.class);
                    try {
                        if (var4_4 == null) {
                            this.logger.finest(ServerRoutingAssertion.L[24]);
                            return;
                        }
                    }
                    catch (InvalidDocumentFormatException v1) {
                        throw ServerRoutingAssertion.b((Exception)v1);
                    }
                    var5_5 = (SecurityKnob)var1_1.getKnob(SecurityKnob.class);
                    if (var5_5 == null) ** GOTO lbl23
                    try {
                        block33: {
                            if (var5_5.getProcessorResult() != null) break block30;
                            break block33;
                            catch (InvalidDocumentFormatException v2) {
                                throw ServerRoutingAssertion.b((Exception)v2);
                            }
                        }
                        this.logger.finest(ServerRoutingAssertion.L[2]);
                        return;
                    }
                    catch (InvalidDocumentFormatException v3) {
                        throw ServerRoutingAssertion.b((Exception)v3);
                    }
                }
                try {
                    if (var2_2 == 0) {
                        this.a(var1_1, var5_5.getProcessorResult());
                        return;
                    }
                }
                catch (InvalidDocumentFormatException v4) {
                    throw ServerRoutingAssertion.b((Exception)v4);
                }
                if (var2_2 == 1) {
                    var6_6 = var5_5.getProcessorResult();
                    try {
                        if (var6_6 != null) {
                            this.a(var1_1, var6_6.getProcessedActor(), var6_6.getProcessedActorUri());
                        }
                    }
                    catch (InvalidDocumentFormatException v5) {
                        throw ServerRoutingAssertion.b((Exception)v5);
                    }
                    return;
                }
                try {
                    if (var2_2 != 2) {
                        this.logAndAudit((AuditDetailMessage)AssertionMessages.EXCEPTION_WARNING_WITH_MORE_INFO, new String[]{ServerRoutingAssertion.L[19] + var2_2});
                        return;
                    }
                }
                catch (InvalidDocumentFormatException v6) {
                    throw ServerRoutingAssertion.b((Exception)v6);
                }
                var6_7 = var1_1.getXmlKnob();
                try {
                    if (!this.a(var1_1, var5_5.getProcessorResult())) {
                        this.logAndAudit((AuditDetailMessage)AssertionMessages.HTTPROUTE_NON_SOAP_WRONG_POLICY);
                        throw new AssertionStatusException(AssertionStatus.SERVER_ERROR);
                    }
                }
                catch (InvalidDocumentFormatException v7) {
                    throw ServerRoutingAssertion.b((Exception)v7);
                }
                try {
                    if (var3_3 == null) {
                        return;
                    }
                }
                catch (InvalidDocumentFormatException v8) {
                    throw ServerRoutingAssertion.b((Exception)v8);
                }
                var7_8 = var6_7.getDocumentReadOnly();
                try {
                    var8_9 = SoapUtil.getSecurityElement((Document)var7_8, (String)var3_3);
                }
                catch (InvalidDocumentFormatException var9_10) {
                    this.logAndAudit((AuditDetailMessage)AssertionMessages.HTTPROUTE_NON_SOAP_WRONG_POLICY, null, var9_10);
                    throw new AssertionStatusException(AssertionStatus.SERVER_ERROR, (Throwable)var9_10);
                }
                try {
                    if (var8_9 == null) break block31;
                    this.logAndAudit((AuditDetailMessage)AssertionMessages.HTTPROUTE_PROMOTING_ACTOR, new String[]{var3_3});
                    var6_7.getDocumentWritable();
                    SoapUtil.nukeActorAttribute((Element)var8_9);
                    break block32;
                }
                catch (InvalidDocumentFormatException v9) {
                    throw ServerRoutingAssertion.b((Exception)v9);
                }
            }
            this.logAndAudit((AuditDetailMessage)AssertionMessages.HTTPROUTE_NO_SECURITY_HEADER, new String[]{var3_3});
        }
    }

    /*
     * Loose catch block
     */
    private boolean a(Message message, SecurityActor securityActor, String string) throws SAXException, IOException {
        Document document = message.getXmlKnob().getDocumentReadOnly();
        try {
            if (!SoapUtil.isSoapMessageMaybe((Document)document)) {
                return false;
            }
        }
        catch (InvalidDocumentFormatException invalidDocumentFormatException) {
            throw ServerRoutingAssertion.b((Exception)((Object)invalidDocumentFormatException));
        }
        try {
            block19: {
                Element element;
                block17: {
                    block18: {
                        block15: {
                            Element element2;
                            block16: {
                                if (securityActor != SecurityActor.L7ACTOR) break block18;
                                element2 = SoapUtil.getSecurityElement((Document)document, (String)string);
                                if (element2 == null) break block19;
                                Element element3 = SoapUtil.getSecurityElement((Document)document);
                                try {
                                    if (element3 != null && element3 != element2) break block15;
                                }
                                catch (InvalidDocumentFormatException invalidDocumentFormatException) {
                                    throw ServerRoutingAssertion.b((Exception)((Object)invalidDocumentFormatException));
                                }
                                Document document2 = message.getXmlKnob().getDocumentWritable();
                                if (d) break block16;
                                try {
                                    block20: {
                                        if (document2 == document) break block16;
                                        break block20;
                                        catch (InvalidDocumentFormatException invalidDocumentFormatException) {
                                            throw ServerRoutingAssertion.b((Exception)((Object)invalidDocumentFormatException));
                                        }
                                    }
                                    throw new AssertionError();
                                }
                                catch (InvalidDocumentFormatException invalidDocumentFormatException) {
                                    throw ServerRoutingAssertion.b((Exception)((Object)invalidDocumentFormatException));
                                }
                            }
                            SoapUtil.nukeActorAttribute((Element)element2);
                            WssDecoratorUtils.promoteDecorationResults((SecurityKnob)message.getSecurityKnob(), (String)string, null);
                            SoapUtil.removeSoapAttr((Element)element2, (String)SoapConstants.MUSTUNDERSTAND_ATTR_NAME);
                            break block19;
                        }
                        String[] stringArray = L;
                        this.logger.info(stringArray[18]);
                        break block19;
                    }
                    if (securityActor != SecurityActor.NOACTOR || (element = SoapUtil.getSecurityElement((Document)document)) == null) break block19;
                    Document document3 = message.getXmlKnob().getDocumentWritable();
                    if (d) break block17;
                    try {
                        block21: {
                            if (document3 == document) break block17;
                            break block21;
                            catch (InvalidDocumentFormatException invalidDocumentFormatException) {
                                throw ServerRoutingAssertion.b((Exception)((Object)invalidDocumentFormatException));
                            }
                        }
                        throw new AssertionError();
                    }
                    catch (InvalidDocumentFormatException invalidDocumentFormatException) {
                        throw ServerRoutingAssertion.b((Exception)((Object)invalidDocumentFormatException));
                    }
                }
                SoapUtil.removeSoapAttr((Element)element, (String)SoapConstants.MUSTUNDERSTAND_ATTR_NAME);
            }
            return true;
        }
        catch (InvalidDocumentFormatException invalidDocumentFormatException) {
            this.logAndAudit((AuditDetailMessage)AssertionMessages.HTTPROUTE_NON_SOAP_WRONG_FORMAT);
            throw new AssertionStatusException(AssertionStatus.SERVER_ERROR, L[14] + ExceptionUtils.getMessage((Throwable)invalidDocumentFormatException), invalidDocumentFormatException);
        }
    }

    /*
     * Loose catch block
     */
    private boolean a(Message message, ProcessorResult processorResult) throws SAXException, IOException {
        Document document = message.getXmlKnob().getDocumentReadOnly();
        try {
            if (!SoapUtil.isSoapMessageMaybe((Document)document)) {
                return false;
            }
        }
        catch (InvalidDocumentFormatException invalidDocumentFormatException) {
            throw ServerRoutingAssertion.b((Exception)((Object)invalidDocumentFormatException));
        }
        try {
            block9: {
                String string;
                SecurityKnob securityKnob;
                block11: {
                    block10: {
                        Element element = this.a(document, processorResult);
                        if (element == null) break block9;
                        try {
                            block12: {
                                message.getXmlKnob().getDocumentWritable();
                                element.getParentNode().removeChild(element);
                                SoapUtil.removeEmptySoapHeader((Document)document);
                                securityKnob = message.getSecurityKnob();
                                if (processorResult != null) break block10;
                                break block12;
                                catch (InvalidDocumentFormatException invalidDocumentFormatException) {
                                    throw ServerRoutingAssertion.b((Exception)((Object)invalidDocumentFormatException));
                                }
                            }
                            string = null;
                            break block11;
                        }
                        catch (InvalidDocumentFormatException invalidDocumentFormatException) {
                            throw ServerRoutingAssertion.b((Exception)((Object)invalidDocumentFormatException));
                        }
                    }
                    string = processorResult.getProcessedActorUri();
                }
                securityKnob.removeDecorationResults(string);
            }
            return true;
        }
        catch (InvalidDocumentFormatException invalidDocumentFormatException) {
            this.logAndAudit((AuditDetailMessage)AssertionMessages.HTTPROUTE_NON_SOAP_WRONG_FORMAT);
            throw new AssertionStatusException(AssertionStatus.SERVER_ERROR, L[4] + ExceptionUtils.getMessage((Throwable)invalidDocumentFormatException), invalidDocumentFormatException);
        }
    }

    private Element a(Document document, ProcessorResult processorResult) throws InvalidDocumentFormatException {
        block4: {
            try {
                try {
                    if (processorResult != null && processorResult.getProcessedActor() == SecurityActor.L7ACTOR) break block4;
                }
                catch (InvalidDocumentFormatException invalidDocumentFormatException) {
                    throw ServerRoutingAssertion.b((Exception)((Object)invalidDocumentFormatException));
                }
                return SoapUtil.getSecurityElement((Document)document);
            }
            catch (InvalidDocumentFormatException invalidDocumentFormatException) {
                throw ServerRoutingAssertion.b((Exception)((Object)invalidDocumentFormatException));
            }
        }
        return SoapUtil.getSecurityElementForL7((Document)document);
    }

    protected void doAttachSamlSenderVouches(RoutingAssertionWithSamlSV routingAssertionWithSamlSV, Message message, LoginCredentials loginCredentials, SignerInfo signerInfo) throws SAXException, IOException, SignatureException, CertificateException, UnrecoverableKeyException {
        KeyInfoInclusionType keyInfoInclusionType;
        KeyInfoInclusionType keyInfoInclusionType2;
        SamlAssertionGenerator.Options options;
        InetAddress inetAddress;
        try {
            if (loginCredentials == null) {
                this.logAndAudit((AuditDetailMessage)AssertionMessages.HTTPROUTE_SAML_SV_NOT_AUTH);
                return;
            }
        }
        catch (UnknownHostException unknownHostException) {
            throw ServerRoutingAssertion.b(unknownHostException);
        }
        Document document = message.getXmlKnob().getDocumentWritable();
        SamlAssertionGenerator samlAssertionGenerator = new SamlAssertionGenerator(signerInfo);
        SamlAssertionGenerator.Options options2 = new SamlAssertionGenerator.Options();
        options2.setAttestingEntity(signerInfo);
        TcpKnob tcpKnob = (TcpKnob)message.getKnob(TcpKnob.class);
        if (tcpKnob != null) {
            try {
                inetAddress = InetAddress.getByName(tcpKnob.getRemoteAddress());
                options2.setClientAddress(inetAddress);
            }
            catch (UnknownHostException unknownHostException) {
                this.logAndAudit((AuditDetailMessage)AssertionMessages.HTTPROUTE_CANT_RESOLVE_IP, null, unknownHostException);
            }
        }
        try {
            options2.setVersion(routingAssertionWithSamlSV.getSamlAssertionVersion());
            options2.setNotAfterSeconds(routingAssertionWithSamlSV.getSamlAssertionExpiry() * 60);
            options = options2;
            keyInfoInclusionType2 = routingAssertionWithSamlSV.isUseThumbprintInSamlSignature() ? KeyInfoInclusionType.STR_THUMBPRINT : KeyInfoInclusionType.CERT;
        }
        catch (UnknownHostException unknownHostException) {
            throw ServerRoutingAssertion.b(unknownHostException);
        }
        try {
            options.setIssuerKeyInfoType(keyInfoInclusionType2);
            keyInfoInclusionType = routingAssertionWithSamlSV.isUseThumbprintInSamlSubject() ? KeyInfoInclusionType.STR_THUMBPRINT : KeyInfoInclusionType.CERT;
        }
        catch (UnknownHostException unknownHostException) {
            throw ServerRoutingAssertion.b(unknownHostException);
        }
        inetAddress = keyInfoInclusionType;
        try {
            if (routingAssertionWithSamlSV.getRecipientContext() != null) {
                options2.setSecurityHeaderActor(routingAssertionWithSamlSV.getRecipientContext().getActor());
            }
        }
        catch (UnknownHostException unknownHostException) {
            throw ServerRoutingAssertion.b(unknownHostException);
        }
        SubjectStatement subjectStatement = SubjectStatement.createAuthenticationStatement((LoginCredentials)loginCredentials, (SubjectStatement.Confirmation)SubjectStatement.SENDER_VOUCHES, (KeyInfoInclusionType)inetAddress, (NameIdentifierInclusionType)NameIdentifierInclusionType.FROM_CREDS, null, null, null, null);
        samlAssertionGenerator.attachStatement(document, subjectStatement, options2);
    }

    protected KerberosServiceTicket getDelegatedKerberosTicket(PolicyEnforcementContext policyEnforcementContext, String string) throws KerberosException {
        KerberosServiceTicket kerberosServiceTicket;
        boolean bl2;
        block6: {
            ProcessorResult processorResult = policyEnforcementContext.getRequest().getSecurityKnob().getProcessorResult();
            AuthenticationContext authenticationContext = policyEnforcementContext.getAuthenticationContext(policyEnforcementContext.getRequest());
            bl2 = false;
            kerberosServiceTicket = null;
            List list = authenticationContext.getCredentials();
            for (LoginCredentials loginCredentials : list) {
                if (!(loginCredentials.getPayload() instanceof KerberosServiceTicket)) continue;
                kerberosServiceTicket = (KerberosServiceTicket)loginCredentials.getPayload();
                bl2 = loginCredentials.getSecurityToken().getClass().isAssignableFrom(KerberosAuthenticationSecurityToken.class);
            }
            try {
                if (processorResult == null || bl2) break block6;
            }
            catch (KerberosException kerberosException) {
                throw ServerRoutingAssertion.b((Exception)((Object)kerberosException));
            }
            kerberosServiceTicket = this.getLastKerberosSigningSecurityToken(processorResult);
        }
        try {
            if (kerberosServiceTicket == null) {
                throw new KerberosException(L[7]);
            }
        }
        catch (KerberosException kerberosException) {
            throw ServerRoutingAssertion.b((Exception)((Object)kerberosException));
        }
        KerberosServiceTicket kerberosServiceTicket2 = bl2 ? kerberosServiceTicket : this.wrapKerberosServiceTicketForDelegation(kerberosServiceTicket, string);
        return kerberosServiceTicket2;
    }

    protected KerberosServiceTicket getLastKerberosSigningSecurityToken(ProcessorResult processorResult) throws KerberosException {
        KerberosServiceTicket kerberosServiceTicket = null;
        XmlSecurityToken[] xmlSecurityTokenArray = processorResult.getXmlSecurityTokens();
        try {
            if (xmlSecurityTokenArray == null) {
                throw new KerberosException(L[12]);
            }
        }
        catch (KerberosException kerberosException) {
            throw ServerRoutingAssertion.b((Exception)((Object)kerberosException));
        }
        for (XmlSecurityToken xmlSecurityToken : xmlSecurityTokenArray) {
            if (!(xmlSecurityToken instanceof KerberosSigningSecurityToken)) continue;
            kerberosServiceTicket = ((KerberosSigningSecurityToken)xmlSecurityToken).getServiceTicket();
        }
        return kerberosServiceTicket;
    }

    protected KerberosServiceTicket wrapKerberosServiceTicketForDelegation(KerberosServiceTicket kerberosServiceTicket, String string) throws KerberosException {
        KerberosRoutingClient kerberosRoutingClient = new KerberosRoutingClient();
        KerberosServiceTicket kerberosServiceTicket2 = kerberosRoutingClient.getKerberosServiceTicket(KerberosRoutingClient.getGSSServiceName((String)L[15], (String)string), kerberosServiceTicket);
        return kerberosServiceTicket2;
    }

    protected int getConnectionTimeout(Map map) {
        return this.a(L[25], 0, Integer.MAX_VALUE, 0);
    }

    protected int getTimeout(Map map) {
        return this.a(L[26], 0, Integer.MAX_VALUE, 0);
    }

    protected int getMaxDuration(Map map) {
        return this.a(L[0], 1, 86400000, 0);
    }

    protected int getStaleCheckCount() {
        return this.a(L[16], 0, 1000, 1);
    }

    private int a(String string, int n2, int n3, int n4) {
        int n5 = n4;
        try {
            String string2 = ConfigFactory.getProperty((String)string, null);
            if (string2 != null) {
                n5 = Integer.parseInt(string2);
                boolean bl2 = false;
                if (n5 < n2) {
                    bl2 = true;
                    int n6 = n4;
                    int n7 = n2;
                    String string3 = string;
                    String[] stringArray = L;
                    this.logger.warning(stringArray[21] + string3 + stringArray[9] + n7 + stringArray[17] + n6 + stringArray[23]);
                } else if (n5 > n3) {
                    bl2 = true;
                    int n8 = n4;
                    int n9 = n3;
                    String string4 = string;
                    String[] stringArray = L;
                    this.logger.warning(stringArray[8] + string4 + stringArray[5] + n9 + stringArray[1] + n8 + stringArray[6]);
                }
                if (bl2) {
                    n5 = n4;
                }
            }
        }
        catch (SecurityException securityException) {
            String string5 = securityException.getMessage();
            int n10 = n4;
            String string6 = string;
            String[] stringArray = L;
            this.logger.warning(stringArray[13] + string6 + stringArray[1] + n10 + stringArray[20] + string5);
        }
        catch (NumberFormatException numberFormatException) {
            String string7 = numberFormatException.getMessage();
            int n11 = n4;
            String string8 = string;
            String[] stringArray = L;
            this.logger.warning(stringArray[22] + string8 + stringArray[1] + n11 + stringArray[3] + string7);
        }
        return n5;
    }

    protected void firePostRouting(PolicyEnforcementContext policyEnforcementContext, Message message, URL uRL, int n2) {
        this.messageProcessingEventChannel.publishEvent((ApplicationEvent)new PostRoutingEvent(this, policyEnforcementContext, message, uRL, n2));
    }

    protected void firePreRouting(PolicyEnforcementContext policyEnforcementContext, Message message, URL uRL) {
        this.messageProcessingEventChannel.publishEvent((ApplicationEvent)new PreRoutingEvent(this, policyEnforcementContext, message, uRL));
    }

    /*
     * Unable to fully structure code
     */
    static {
        block12: {
            block11: {
                var5 = new String[27];
                var3_1 = 0;
                var2_2 = ".E\"\u001eI\u0007\u0018?n\u0018\u0019\\>\u0010(D\u0018`\u0006M\u001eN#\u0017 \n\t\u000e[+\f+^M\u001d\\&\f\"\nJ8\u0014A\u0004\u001bM#\u0017 \n\u001e\u000e^?\u000b.^\u0014KU/\u0018#O\u001fKM8\u0016$O\u001e\u0018T$\u001ek\n\u0003\u0004\u001d\"\u001c&N\b\u0019\u001d:\u000b(I\b\u0018N/\u001d\r`\u0006M\u000eO8\u00165\n\u0004\u0018\u0007j\"\u0012D\f\tQ/Y3EM\u0019X'\u00161OM8X)\f5C\u0019\u0012\u001d\"\u001c&N\b\u0019\u0007j\u0019`\u0006M\u0002Nj8\u0005e;.\u001d>\u0011\"\n\u0000\nE#\u00142GML\u0002`\u0004/\tEM X8\u001b\"X\u0002\u0018\u001d9\u001c5\\\u0004\bXj\r.I\u0006\u000eIj\u001f(_\u0003\u000f\u001d#\u0017g^\u0005\u000e\u001d8\u001c6_\b\u0018I\u001f\u0004E\u0003\rT-\f5O\tKK+\u00152OM\rR8Y7X\u0002\u001bX8\r>\nJ\u0019`\u0006M\u0002Nj;\u0002f\"<\u001d>\u0011\"\n\u0000\u0002S#\u00142GML\f&_\t\u0002I\f\u0018$^\u0002\u0019D\u001d*O\u001e\u0018\\-\u001c\u0017X\u0002\bX9\n.D\n.K/\u00173i\u0005\nS$\u001c+#\tEM\u0018X)\f5C\u0019\u0012\u001d>\u0016,O\u0003\u0018\u001d,\u00162D\tKT$Y5O\u001c\u001eX9\r\u0018\u0004K\u0003\u0005R>Y&I\u000e\u000eN9Y7X\u0002\u001bX8\r>\nJ$\u0012D\f\tQ/Y3EM\bQ/\u0018)\n\u0018\u001b\u001d\u0019\u001c$_\u001f\u0002I3Y/O\f\u000fX8Cg\u0004/^\u0019\u001b\u0011.E>\u001f\\&\u001c\u0004B\b\bV\t\u00162D\u0019\u0018`\u0006M\u001eN#\u0017 \n\t\u000e[+\f+^M\u001d\\&\f\"\nJ\u00880OM\b\\$^3\n\u001d\u0019R'\u00163OM\u0007\nj\n\"IM\u0003X+\u001d\"XM\nNj\u0017(\n\f\bI%\u000bgH\b\b\\?\n\"\n\u0019\u0003X8\u001cgC\u001eK\\&\u000b\"K\t\u0012\u001d+Y)E\f\bI%\u000bgE\u0003\u000e\u001d:\u000b\"Y\b\u0005IdY3B\b\u0019Xj\u0014&SM\tXj\n(G\b\u001fU#\u0017 \n\u001a\u0019R$\u001eg]\u0004\u001fUj\r/C\u001eKM%\u0015.I\u0014$\u0012D\b\u0013M/\u001a3O\tKN/\u001a\u000fO\f\u000fX81&D\t\u0007T$\u001e\bZ\u0019\u0002R$Cg\r`\u0006M\u000eO8\u00165\n\u0004\u0018\u0007j\u001f\u0004E\u0003\rT-\f5O\tKK+\u00152OM\rR8Y7X\u0002\u001bX8\r>\nJ\u0017\u0004K\u0003\u0005R>Y7K\u001f\u0018Xj\t5E\u001d\u000eO>\u0000g\r\u0002`\u00044\u0014A\u0004\u001bM#\u0017 \n\u001e\u000e^?\u000b.^\u0014KU/\u0018#O\u001fKM8\u0016$O\u001e\u0018T$\u001ek\n\u0000\u000eN9\u0018 OM\u0005R>Y\u001fg!";
                var4_3 = ".E\"\u001eI\u0007\u0018?n\u0018\u0019\\>\u0010(D\u0018`\u0006M\u001eN#\u0017 \n\t\u000e[+\f+^M\u001d\\&\f\"\nJ8\u0014A\u0004\u001bM#\u0017 \n\u001e\u000e^?\u000b.^\u0014KU/\u0018#O\u001fKM8\u0016$O\u001e\u0018T$\u001ek\n\u0003\u0004\u001d\"\u001c&N\b\u0019\u001d:\u000b(I\b\u0018N/\u001d\r`\u0006M\u000eO8\u00165\n\u0004\u0018\u0007j\"\u0012D\f\tQ/Y3EM\u0019X'\u00161OM8X)\f5C\u0019\u0012\u001d\"\u001c&N\b\u0019\u0007j\u0019`\u0006M\u0002Nj8\u0005e;.\u001d>\u0011\"\n\u0000\nE#\u00142GML\u0002`\u0004/\tEM X8\u001b\"X\u0002\u0018\u001d9\u001c5\\\u0004\bXj\r.I\u0006\u000eIj\u001f(_\u0003\u000f\u001d#\u0017g^\u0005\u000e\u001d8\u001c6_\b\u0018I\u001f\u0004E\u0003\rT-\f5O\tKK+\u00152OM\rR8Y7X\u0002\u001bX8\r>\nJ\u0019`\u0006M\u0002Nj;\u0002f\"<\u001d>\u0011\"\n\u0000\u0002S#\u00142GML\f&_\t\u0002I\f\u0018$^\u0002\u0019D\u001d*O\u001e\u0018\\-\u001c\u0017X\u0002\bX9\n.D\n.K/\u00173i\u0005\nS$\u001c+#\tEM\u0018X)\f5C\u0019\u0012\u001d>\u0016,O\u0003\u0018\u001d,\u00162D\tKT$Y5O\u001c\u001eX9\r\u0018\u0004K\u0003\u0005R>Y&I\u000e\u000eN9Y7X\u0002\u001bX8\r>\nJ$\u0012D\f\tQ/Y3EM\bQ/\u0018)\n\u0018\u001b\u001d\u0019\u001c$_\u001f\u0002I3Y/O\f\u000fX8Cg\u0004/^\u0019\u001b\u0011.E>\u001f\\&\u001c\u0004B\b\bV\t\u00162D\u0019\u0018`\u0006M\u001eN#\u0017 \n\t\u000e[+\f+^M\u001d\\&\f\"\nJ\u00880OM\b\\$^3\n\u001d\u0019R'\u00163OM\u0007\nj\n\"IM\u0003X+\u001d\"XM\nNj\u0017(\n\f\bI%\u000bgH\b\b\\?\n\"\n\u0019\u0003X8\u001cgC\u001eK\\&\u000b\"K\t\u0012\u001d+Y)E\f\bI%\u000bgE\u0003\u000e\u001d:\u000b\"Y\b\u0005IdY3B\b\u0019Xj\u0014&SM\tXj\n(G\b\u001fU#\u0017 \n\u001a\u0019R$\u001eg]\u0004\u001fUj\r/C\u001eKM%\u0015.I\u0014$\u0012D\b\u0013M/\u001a3O\tKN/\u001a\u000fO\f\u000fX81&D\t\u0007T$\u001e\bZ\u0019\u0002R$Cg\r`\u0006M\u000eO8\u00165\n\u0004\u0018\u0007j\u001f\u0004E\u0003\rT-\f5O\tKK+\u00152OM\rR8Y7X\u0002\u001bX8\r>\nJ\u0017\u0004K\u0003\u0005R>Y7K\u001f\u0018Xj\t5E\u001d\u000eO>\u0000g\r\u0002`\u00044\u0014A\u0004\u001bM#\u0017 \n\u001e\u000e^?\u000b.^\u0014KU/\u0018#O\u001fKM8\u0016$O\u001e\u0018T$\u001ek\n\u0000\u000eN9\u0018 OM\u0005R>Y\u001fg!".length();
                var1_4 = 16;
                var0_5 = -1;
lbl7:
                // 2 sources

                while (true) {
                    v0 = 72;
                    v1 = ++var0_5;
                    v2 = var2_2.substring(v1, v1 + var1_4);
                    v3 = -1;
                    break block11;
                    break;
                }
lbl13:
                // 1 sources

                while (true) {
                    var5[var3_1++] = ServerRoutingAssertion.b(v0, ServerRoutingAssertion.f(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "k\u0000g[\fLSl\u0001MM\ffSl;AC\u001d`Iv\u0010k\u0000g[\f]Yc\u000b|G\u0015jSw\u001b";
                    var4_3 = "k\u0000g[\fLSl\u0001MM\ffSl;AC\u001d`Iv\u0010k\u0000g[\f]Yc\u000b|G\u0015jSw\u001b".length();
                    var1_4 = 22;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 13;
                        v4 = ++var0_5;
                        v2 = var2_2.substring(v4, v4 + var1_4);
                        v3 = 0;
                        break block11;
                        break;
                    }
                    break;
                }
lbl28:
                // 1 sources

                while (true) {
                    var5[var3_1++] = ServerRoutingAssertion.b(v0, ServerRoutingAssertion.f(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    break block12;
                    break;
                }
            }
            switch (v3) {
                default: {
                    ** continue;
                }
                ** case 0:
lbl39:
                // 1 sources

                ** continue;
            }
        }
        ServerRoutingAssertion.L = var5;
        try {
            v5 = ServerRoutingAssertion.class.desiredAssertionStatus() == false;
        }
        catch (AssertionStatusException v6) {
            throw ServerRoutingAssertion.b(v6);
        }
        ServerRoutingAssertion.d = v5;
    }

    private static Exception b(Exception exception) {
        return exception;
    }

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

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String b(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 -> 15;
                    case 1 -> 98;
                    case 2 -> 37;
                    case 3 -> 35;
                    case 4 -> 117;
                    case 5 -> 2;
                    default -> 49;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

