/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.common.mime.NoSuchPartException
 *  com.l7tech.message.Message
 *  com.l7tech.message.ValidationTarget
 */
package com.l7tech.server.communityschemas;

import com.l7tech.common.mime.NoSuchPartException;
import com.l7tech.message.Message;
import com.l7tech.message.ValidationTarget;
import com.l7tech.server.communityschemas.SchemaValidationErrorHandler;
import com.l7tech.server.communityschemas.p;
import com.l7tech.server.util.Handle;
import java.io.IOException;
import org.xml.sax.SAXException;

public final class SchemaHandle
extends Handle<p> {
    private final String c;
    private final String d;
    private static final String[] e;

    SchemaHandle(p p2) {
        super(p2);
        this.c = p2.getSystemId();
        this.d = p2.getTargetNamespace();
    }

    public void validateMessage(Message message, ValidationTarget validationTarget, SchemaValidationErrorHandler schemaValidationErrorHandler) throws NoSuchPartException, IOException, SAXException {
        this.b().a(message, validationTarget, schemaValidationErrorHandler);
    }

    @Override
    protected p getTarget() {
        return (p)super.getTarget();
    }

    p b() {
        p p2 = this.getTarget();
        try {
            if (p2 == null) {
                throw new IllegalStateException(e[0] + this.c + e[1] + this.d + ")");
            }
        }
        catch (IllegalStateException illegalStateException) {
            throw SchemaHandle.a(illegalStateException);
        }
        return p2;
    }

    private static IllegalStateException a(IllegalStateException illegalStateException) {
        return illegalStateException;
    }

    /*
     * Enabled aggressive block sorting
     */
    static {
        String[] stringArray = new String[2];
        int n2 = 0;
        String string = "JS@Oo4KkR\u0001[b=\u0002{\\UH#\"\bwXLL#|F?nBEf<\nW\\OIo4Kw\\R\rb=\u0019z\\ET#3\u000ezS\u0001No>\u0018zY\u0001\u0005p(\u0018kXLdgl\u0007?\u001d\u0001Ym\"V";
        int n3 = "JS@Oo4KkR\u0001[b=\u0002{\\UH#\"\bwXLL#|F?nBEf<\nW\\OIo4Kw\\R\rb=\u0019z\\ET#3\u000ezS\u0001No>\u0018zY\u0001\u0005p(\u0018kXLdgl\u0007?\u001d\u0001Ym\"V".length();
        int n4 = 76;
        int n5 = -1;
        while (true) {
            int n6 = ++n5;
            stringArray[n2++] = SchemaHandle.a(90, SchemaHandle.a(string.substring(n6, n6 + n4)));
            if ((n5 += n4) >= n3) {
                e = stringArray;
                return;
            }
            n4 = string.charAt(n5);
        }
    }

    private static char[] a(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 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 -> 69;
                    case 1 -> 103;
                    case 2 -> 123;
                    case 3 -> 119;
                    case 4 -> 89;
                    case 5 -> 11;
                    default -> 49;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

