/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.message.Message
 *  com.l7tech.message.MimeKnob
 */
package com.l7tech.server.policy.variable;

import com.l7tech.message.Message;
import com.l7tech.message.MimeKnob;
import com.l7tech.server.audit.AuditSinkPolicyEnforcementContext;
import com.l7tech.server.message.PolicyEnforcementContext;
import com.l7tech.server.policy.variable.dn;
import java.io.IOException;

class dq
extends dn {
    private final boolean a;

    private dq(boolean bl2) {
        this.a = bl2;
    }

    @Override
    Object get(String string, PolicyEnforcementContext policyEnforcementContext) {
        if (policyEnforcementContext instanceof AuditSinkPolicyEnforcementContext) {
            Message message;
            AuditSinkPolicyEnforcementContext auditSinkPolicyEnforcementContext = (AuditSinkPolicyEnforcementContext)policyEnforcementContext;
            try {
                message = this.a ? auditSinkPolicyEnforcementContext.getOriginalResponse() : auditSinkPolicyEnforcementContext.getOriginalRequest();
            }
            catch (IOException iOException) {
                throw dq.a(iOException);
            }
            Message message2 = message;
            try {
                if (message2 == null) {
                    return null;
                }
            }
            catch (IOException iOException) {
                throw dq.a(iOException);
            }
            MimeKnob mimeKnob = (MimeKnob)message2.getKnob(MimeKnob.class);
            try {
                if (mimeKnob == null) {
                    return null;
                }
            }
            catch (IOException iOException) {
                throw dq.a(iOException);
            }
            try {
                return mimeKnob.getContentLength();
            }
            catch (IOException iOException) {
                return null;
            }
        }
        return null;
    }

    private static IOException a(IOException iOException) {
        return iOException;
    }
}

