/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.common.io.DocumentReferenceProcessor
 *  com.l7tech.common.io.DocumentReferenceProcessor$ReferenceCustomizer
 *  com.l7tech.common.io.IOExceptionThrowingReader
 *  com.l7tech.common.io.ResourceReference
 *  com.l7tech.common.io.SchemaUtil
 *  com.l7tech.common.io.XmlUtil
 *  com.l7tech.common.io.XmlUtil$BadSchemaException
 *  com.l7tech.gateway.common.audit.Audit
 *  com.l7tech.util.CausedIOException
 *  com.l7tech.util.CollectionUtils
 *  com.l7tech.util.ConfigFactory
 *  com.l7tech.util.DomUtils
 *  com.l7tech.util.ExceptionUtils
 *  com.l7tech.util.LSInputImpl
 *  com.l7tech.util.Triple
 *  org.springframework.context.ApplicationEvent
 *  org.springframework.jmx.export.annotation.ManagedAttribute
 *  org.springframework.jmx.export.annotation.ManagedOperation
 *  org.springframework.jmx.export.annotation.ManagedResource
 */
package com.l7tech.server.communityschemas;

import com.l7tech.common.io.DocumentReferenceProcessor;
import com.l7tech.common.io.IOExceptionThrowingReader;
import com.l7tech.common.io.ResourceReference;
import com.l7tech.common.io.SchemaUtil;
import com.l7tech.common.io.XmlUtil;
import com.l7tech.gateway.common.audit.Audit;
import com.l7tech.server.communityschemas.SchemaConfiguration;
import com.l7tech.server.communityschemas.SchemaHandle;
import com.l7tech.server.communityschemas.SchemaManager;
import com.l7tech.server.communityschemas.SchemaSourceResolver;
import com.l7tech.server.communityschemas.i;
import com.l7tech.server.communityschemas.j;
import com.l7tech.server.communityschemas.k;
import com.l7tech.server.communityschemas.l;
import com.l7tech.server.communityschemas.n;
import com.l7tech.server.communityschemas.o;
import com.l7tech.server.communityschemas.p;
import com.l7tech.server.communityschemas.r;
import com.l7tech.server.communityschemas.s;
import com.l7tech.server.util.AbstractCloseable;
import com.l7tech.server.util.PostStartupApplicationListener;
import com.l7tech.util.CausedIOException;
import com.l7tech.util.CollectionUtils;
import com.l7tech.util.ConfigFactory;
import com.l7tech.util.DomUtils;
import com.l7tech.util.ExceptionUtils;
import com.l7tech.util.LSInputImpl;
import com.l7tech.util.Triple;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
import java.util.TreeSet;
import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.springframework.context.ApplicationEvent;
import org.springframework.jmx.export.annotation.ManagedAttribute;
import org.springframework.jmx.export.annotation.ManagedOperation;
import org.springframework.jmx.export.annotation.ManagedResource;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.ls.LSInput;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.ext.EntityResolver2;

@ManagedResource(description="XML Schema Manager", objectName="l7tech:type=XMLSchemaManager")
public class SchemaManagerImpl
implements PostStartupApplicationListener,
SchemaManager,
SchemaSourceResolver.SchemaInvalidationListener {
    private static final Logger a;
    private static final long b;
    private static final boolean c;
    private static final boolean d;
    private final SchemaConfiguration e;
    private final ReadWriteLock f = new ReentrantReadWriteLock(false);
    private final Map<String, SchemaHandle> g = new ConcurrentHashMap<String, SchemaHandle>();
    private final Map<String, Map<p, Object>> h = new WeakHashMap<String, Map<p, Object>>();
    private final Map<String, SchemaResource> i = new ConcurrentHashMap<String, SchemaResource>();
    private final Map<String, Set<SchemaResource>> j = new ConcurrentHashMap<String, Set<SchemaResource>>();
    private final Map<String, Integer> k = new HashMap<String, Integer>();
    private final Map<String, Integer> l = new ConcurrentHashMap<String, Integer>();
    private final Map<SchemaHandle, Object> m = new WeakHashMap<SchemaHandle, Object>();
    private final AtomicReference<EntityResolver> n = new AtomicReference<EntityResolver>(XmlUtil.getSafeEntityResolver());
    private final AtomicReference<n> o = new AtomicReference<o>(new o());
    private final Collection<SchemaSourceResolver> p;
    private final EntityResolver q;
    private final Timer r;
    private r s;
    static final /* synthetic */ boolean t;
    private static final String[] u;

    public SchemaManagerImpl(SchemaConfiguration schemaConfiguration, Timer timer, SchemaSourceResolver[] schemaSourceResolverArray, EntityResolver entityResolver) {
        if (schemaConfiguration == null) {
            throw new NullPointerException();
        }
        this.e = schemaConfiguration;
        ArrayList<SchemaSourceResolver> arrayList = new ArrayList<SchemaSourceResolver>();
        arrayList.add(new l(this.i, this.j));
        arrayList.addAll(Arrays.asList(schemaSourceResolverArray));
        this.p = Collections.unmodifiableCollection(arrayList);
        this.q = entityResolver;
        if (timer == null) {
            timer = new Timer(u[0], true);
        }
        this.r = timer;
        this.a();
        for (SchemaSourceResolver schemaSourceResolver : this.p) {
            schemaSourceResolver.registerInvalidationListener(this);
        }
    }

    private synchronized void a() {
        block6: {
            block5: {
                try {
                    if (this.s != null) {
                        this.s.cancel();
                        this.s = null;
                    }
                }
                catch (NullPointerException nullPointerException) {
                    throw SchemaManagerImpl.a(nullPointerException);
                }
                try {
                    this.s = new s(this);
                    this.r.schedule((TimerTask)this.s, 4539L, Math.min(b, (long)(this.e.getMaxCacheAge() * 2 + 263)));
                    if (!this.e.isAllowDoctype()) break block5;
                    this.n.set(this.q);
                    this.o.set(new n());
                    break block6;
                }
                catch (NullPointerException nullPointerException) {
                    throw SchemaManagerImpl.a(nullPointerException);
                }
            }
            this.n.set(XmlUtil.getSafeEntityResolver());
            this.o.set(new o());
        }
    }

    public void onApplicationEvent(ApplicationEvent applicationEvent) {
        if (applicationEvent instanceof SchemaConfiguration.SchemaConfigurationReloadedEvent) {
            String[] stringArray = u;
            a.info(stringArray[25]);
            try {
                this.a();
            }
            catch (Exception exception) {
                a.log(Level.SEVERE, u[46] + ExceptionUtils.getMessage((Throwable)exception), exception);
            }
        }
    }

    private void a(String string) {
        SchemaHandle schemaHandle = this.g.remove(string);
        try {
            if (schemaHandle != null) {
                this.l.put(string, 1);
                this.a(schemaHandle);
            }
        }
        catch (NullPointerException nullPointerException) {
            throw SchemaManagerImpl.a(nullPointerException);
        }
    }

    private boolean a(String string, long l2) {
        boolean bl2;
        block8: {
            block7: {
                SchemaHandle schemaHandle = this.g.get(string);
                try {
                    block6: {
                        try {
                            try {
                                if (schemaHandle == null) break block6;
                                if (this.e.getMaxStaleAge() <= -1) break block7;
                            }
                            catch (NullPointerException nullPointerException) {
                                throw SchemaManagerImpl.a(nullPointerException);
                            }
                            if (l2 - schemaHandle.b().i() <= (long)this.e.getMaxStaleAge()) break block7;
                        }
                        catch (NullPointerException nullPointerException) {
                            throw SchemaManagerImpl.a(nullPointerException);
                        }
                    }
                    bl2 = true;
                    break block8;
                }
                catch (NullPointerException nullPointerException) {
                    throw SchemaManagerImpl.a(nullPointerException);
                }
            }
            bl2 = false;
        }
        return bl2;
    }

    private synchronized void a(SchemaHandle schemaHandle) {
        this.m.put(schemaHandle, null);
    }

    /*
     * Exception decompiling
     */
    private void b() {
        /*
         * This method has failed to decompile.  When submitting a bug report, please provide this stack trace, and (if you hold appropriate legal rights) the relevant class file.
         * 
         * org.benf.cfr.reader.util.ConfusedCFRException: Started 3 blocks at once
         *     at org.benf.cfr.reader.bytecode.analysis.opgraph.Op04StructuredStatement.getStartingBlocks(Op04StructuredStatement.java:412)
         *     at org.benf.cfr.reader.bytecode.analysis.opgraph.Op04StructuredStatement.buildNestedBlocks(Op04StructuredStatement.java:487)
         *     at org.benf.cfr.reader.bytecode.analysis.opgraph.Op03SimpleStatement.createInitialStructuredBlock(Op03SimpleStatement.java:736)
         *     at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:850)
         *     at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisOrWrapFail(CodeAnalyser.java:278)
         *     at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysis(CodeAnalyser.java:201)
         *     at org.benf.cfr.reader.entities.attributes.AttributeCode.analyse(AttributeCode.java:94)
         *     at org.benf.cfr.reader.entities.Method.analyse(Method.java:531)
         *     at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1055)
         *     at org.benf.cfr.reader.entities.ClassFile.analyseTop(ClassFile.java:942)
         *     at org.benf.cfr.reader.Driver.doJarVersionTypes(Driver.java:257)
         *     at org.benf.cfr.reader.Driver.doJar(Driver.java:139)
         *     at org.benf.cfr.reader.CfrDriverImpl.analyse(CfrDriverImpl.java:76)
         *     at org.benf.cfr.reader.Main.main(Main.java:54)
         */
        throw new IllegalStateException("Decompilation failed");
    }

    private String a(p p2) {
        String string;
        try {
            string = p2.getTargetNamespace() == null ? "" : p2.getTargetNamespace();
        }
        catch (NullPointerException nullPointerException) {
            throw SchemaManagerImpl.a(nullPointerException);
        }
        return string;
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    private void c() {
        ArrayList<SchemaHandle> arrayList;
        SchemaManagerImpl schemaManagerImpl = this;
        synchronized (schemaManagerImpl) {
            if (this.m.isEmpty()) {
                return;
            }
            arrayList = new ArrayList<SchemaHandle>(this.m.keySet());
            this.m.clear();
        }
        a.log(Level.FINE, u[4], arrayList.size());
        for (SchemaHandle schemaHandle : arrayList) {
            try {
                if (schemaHandle == null) continue;
                schemaHandle.close();
            }
            catch (NullPointerException nullPointerException) {
                throw SchemaManagerImpl.a(nullPointerException);
            }
        }
    }

    private static void a(p p2, Set<p> set) {
        try {
            if (set.contains(p2)) {
                return;
            }
        }
        catch (NullPointerException nullPointerException) {
            throw SchemaManagerImpl.a(nullPointerException);
        }
        set.add(p2);
        Set<p> set2 = p2.f();
        for (p p3 : set2) {
            try {
                if (p3 == null) continue;
                SchemaManagerImpl.a(p3, set);
            }
            catch (NullPointerException nullPointerException) {
                throw SchemaManagerImpl.a(nullPointerException);
            }
        }
    }

    private void a(String string, Set<p> set) {
        ArrayList<SchemaHandle> arrayList = new ArrayList<SchemaHandle>(this.g.values());
        for (SchemaHandle schemaHandle : arrayList) {
            p p2 = schemaHandle.getTarget();
            try {
                if (p2 == null) {
                    continue;
                }
            }
            catch (NullPointerException nullPointerException) {
                throw SchemaManagerImpl.a(nullPointerException);
            }
            Collection<SchemaHandle> collection = p2.e().values();
            for (SchemaHandle schemaHandle2 : collection) {
                p p3 = schemaHandle2.getTarget();
                try {
                    if (p3 == null) {
                        continue;
                    }
                }
                catch (NullPointerException nullPointerException) {
                    throw SchemaManagerImpl.a(nullPointerException);
                }
                try {
                    if (!string.equals(p3.getSystemId())) continue;
                    SchemaManagerImpl.a(p3, set);
                }
                catch (NullPointerException nullPointerException) {
                    throw SchemaManagerImpl.a(nullPointerException);
                }
            }
        }
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     * Loose catch block
     */
    @Override
    public SchemaHandle getSchemaByUri(Audit audit, String string) throws IOException, SAXException {
        Object object;
        block14: {
            this.f.readLock().lock();
            try {
                object = this.b(string);
                if (object != null) {
                    SchemaHandle schemaHandle = object;
                    return schemaHandle;
                }
            }
            finally {
                this.f.readLock().unlock();
            }
            object = this.a(audit, string, string, true, true, false, true);
            if (t) break block14;
            try {
                block15: {
                    if (object.getContent() != null) break block14;
                    break block15;
                    catch (IOException iOException) {
                        throw SchemaManagerImpl.a(iOException);
                    }
                }
                throw new AssertionError();
            }
            catch (IOException iOException) {
                throw SchemaManagerImpl.a(iOException);
            }
        }
        this.f.writeLock().lock();
        try {
            SchemaHandle schemaHandle = this.b(string);
            if (schemaHandle != null) {
                SchemaHandle schemaHandle2 = schemaHandle;
                return schemaHandle2;
            }
            SchemaHandle schemaHandle3 = this.a(audit, string, (SchemaSourceResolver.SchemaSource)object);
            return schemaHandle3;
        }
        finally {
            this.f.writeLock().unlock();
        }
    }

    private SchemaHandle b(String string) {
        SchemaHandle schemaHandle = this.g.get(string);
        if (schemaHandle != null) {
            p p2 = schemaHandle.getTarget();
            try {
                if (p2 != null) {
                    return p2.ref();
                }
            }
            catch (NullPointerException nullPointerException) {
                throw SchemaManagerImpl.a(nullPointerException);
            }
        }
        return null;
    }

    private SchemaSourceResolver.SchemaSource a(Audit audit, String string, String string2, boolean bl2, boolean bl3, boolean bl4, boolean bl5) throws IOException {
        block23: {
            SchemaSourceResolver.SchemaSource schemaSource;
            block24: {
                block22: {
                    try {
                        try {
                            if (bl2 || !this.c(string2)) break block22;
                        }
                        catch (IOException iOException) {
                            throw SchemaManagerImpl.a(iOException);
                        }
                        throw new IOException(u[15] + string2);
                    }
                    catch (IOException iOException) {
                        throw SchemaManagerImpl.a(iOException);
                    }
                }
                for (SchemaSourceResolver schemaSourceResolver : this.p) {
                    if (schemaSourceResolver.isRemote()) continue;
                    schemaSource = schemaSourceResolver.getSchemaByUri(audit, string2);
                    try {
                        if (schemaSource == null) continue;
                        return schemaSource;
                    }
                    catch (IOException iOException) {
                        throw SchemaManagerImpl.a(iOException);
                    }
                }
                string2 = this.b(string, string2);
                for (SchemaSourceResolver schemaSourceResolver : this.p) {
                    if (schemaSourceResolver.isRemote()) continue;
                    schemaSource = schemaSourceResolver.getSchemaByUri(audit, string2);
                    try {
                        if (schemaSource == null) continue;
                        return schemaSource;
                    }
                    catch (IOException iOException) {
                        throw SchemaManagerImpl.a(iOException);
                    }
                }
                try {
                    try {
                        try {
                            if (bl4 && !c) break block23;
                        }
                        catch (IOException iOException) {
                            throw SchemaManagerImpl.a(iOException);
                        }
                        if (bl3) break block24;
                    }
                    catch (IOException iOException) {
                        throw SchemaManagerImpl.a(iOException);
                    }
                    this.d(string2);
                }
                catch (IOException iOException) {
                    throw SchemaManagerImpl.a(iOException);
                }
            }
            for (SchemaSourceResolver schemaSourceResolver : this.p) {
                if (!schemaSourceResolver.isRemote()) continue;
                schemaSource = schemaSourceResolver.getSchemaByUri(audit, string2);
                try {
                    if (schemaSource == null) continue;
                    return schemaSource;
                }
                catch (IOException iOException) {
                    throw SchemaManagerImpl.a(iOException);
                }
            }
        }
        try {
            if (bl5) {
                throw new IOException(u[43] + SchemaManagerImpl.a(string, string2));
            }
        }
        catch (IOException iOException) {
            throw SchemaManagerImpl.a(iOException);
        }
        return null;
    }

    private SchemaSourceResolver.SchemaSource a(Audit audit, String string, String string2, boolean bl2, boolean bl3, boolean bl4) throws IOException {
        String string3 = this.a(audit, string2);
        try {
            if (string3 != null) {
                return this.a(audit, string, string3, bl2, bl3, bl4, true);
            }
        }
        catch (IOException iOException) {
            throw SchemaManagerImpl.a(iOException);
        }
        throw new CausedIOException(u[3] + string2);
    }

    private boolean c(String string) {
        boolean bl2;
        block5: {
            block4: {
                try {
                    try {
                        if (!string.trim().toLowerCase().startsWith(u[13]) && !string.contains(u[36])) break block4;
                    }
                    catch (NullPointerException nullPointerException) {
                        throw SchemaManagerImpl.a(nullPointerException);
                    }
                    bl2 = true;
                    break block5;
                }
                catch (NullPointerException nullPointerException) {
                    throw SchemaManagerImpl.a(nullPointerException);
                }
            }
            bl2 = false;
        }
        return bl2;
    }

    private void d(String string) throws IOException {
        block4: {
            Pattern pattern = this.e.getRemoteResourcePattern();
            try {
                try {
                    if (pattern != null && pattern.matcher(string).matches()) break block4;
                }
                catch (IOException iOException) {
                    throw SchemaManagerImpl.a(iOException);
                }
                throw new IOException(u[16]);
            }
            catch (IOException iOException) {
                throw SchemaManagerImpl.a(iOException);
            }
        }
    }

    private LSInput a(String string, String string2, String string3) {
        LSInputImpl lSInputImpl;
        block9: {
            EntityResolver entityResolver = this.n.get();
            lSInputImpl = new LSInputImpl();
            try {
                InputSource inputSource = entityResolver instanceof EntityResolver2 ? ((EntityResolver2)entityResolver).resolveEntity(u[28], string, string3, string2) : (string3 != null ? entityResolver.resolveEntity(string, this.b(string3, string2)) : entityResolver.resolveEntity(string, string2));
                if (inputSource != null) {
                    block10: {
                        block8: {
                            lSInputImpl.setPublicId(string);
                            lSInputImpl.setSystemId(inputSource.getSystemId());
                            lSInputImpl.setEncoding(inputSource.getEncoding());
                            Reader reader = inputSource.getCharacterStream();
                            try {
                                if (reader == null) break block8;
                                lSInputImpl.setCharacterStream(reader);
                                break block9;
                            }
                            catch (SAXException sAXException) {
                                throw SchemaManagerImpl.a(sAXException);
                            }
                        }
                        InputStream inputStream = inputSource.getByteStream();
                        try {
                            if (inputStream == null) break block10;
                            lSInputImpl.setByteStream(inputStream);
                            break block9;
                        }
                        catch (SAXException sAXException) {
                            throw SchemaManagerImpl.a(sAXException);
                        }
                    }
                    throw new UnresolvableException(null, SchemaManagerImpl.a(string3, string2, string, null));
                }
                throw new UnresolvableException(null, SchemaManagerImpl.a(string3, string2, string, null));
            }
            catch (SAXException sAXException) {
                this.handleResourceNotPermitted(sAXException, SchemaManagerImpl.a(string3, string2, string, null));
                lSInputImpl.setCharacterStream((Reader)new IOExceptionThrowingReader((IOException)new CausedIOException((Throwable)sAXException)));
            }
            catch (IOException iOException) {
                this.handleResourceNotPermitted(iOException, SchemaManagerImpl.a(string3, string2, string, null));
                lSInputImpl.setCharacterStream((Reader)new IOExceptionThrowingReader(iOException));
            }
        }
        return lSInputImpl;
    }

    protected void handleResourceNotPermitted(Exception exception, String string) throws UnresolvableException {
        block4: {
            Exception exception2;
            block6: {
                block5: {
                    try {
                        try {
                            if (!this.isResourceNotPermitted(exception)) break block4;
                            if (!this.e.isAllowDoctype()) break block5;
                        }
                        catch (UnresolvableException unresolvableException) {
                            throw SchemaManagerImpl.a(unresolvableException);
                        }
                        exception2 = null;
                        break block6;
                    }
                    catch (UnresolvableException unresolvableException) {
                        throw SchemaManagerImpl.a(unresolvableException);
                    }
                }
                exception2 = SchemaManagerImpl.d();
            }
            Exception exception3 = exception2;
            throw new UnresolvableException(exception3, string);
        }
    }

    private static Exception d() {
        return new Exception(u[50]);
    }

    protected boolean isResourceNotPermitted(Exception exception) {
        boolean bl2;
        block7: {
            block6: {
                try {
                    try {
                        try {
                            if (!(exception instanceof IOException) && !(exception instanceof SAXException)) break block6;
                        }
                        catch (NullPointerException nullPointerException) {
                            throw SchemaManagerImpl.a(nullPointerException);
                        }
                        if (!ExceptionUtils.getMessage((Throwable)exception).startsWith(u[21])) break block6;
                    }
                    catch (NullPointerException nullPointerException) {
                        throw SchemaManagerImpl.a(nullPointerException);
                    }
                    bl2 = true;
                    break block7;
                }
                catch (NullPointerException nullPointerException) {
                    throw SchemaManagerImpl.a(nullPointerException);
                }
            }
            bl2 = false;
        }
        return bl2;
    }

    private InputSource a(SchemaResource schemaResource) {
        InputSource inputSource = new InputSource();
        inputSource.setSystemId(schemaResource.getUri());
        inputSource.setCharacterStream(new StringReader(schemaResource.getContent()));
        return inputSource;
    }

    private void b(p p2) {
        this.b(p2, new HashSet<p>());
    }

    /*
     * WARNING - void declaration
     */
    private void b(p p2, Set<p> set) {
        try {
            if (p2 == null) {
                return;
            }
        }
        catch (NullPointerException nullPointerException) {
            throw SchemaManagerImpl.a(nullPointerException);
        }
        for (SchemaHandle map : p2.e().values()) {
            this.b(map.getTarget(), set);
        }
        if (!set.contains(p2)) {
            block14: {
                void var4_7;
                String string = this.a(p2);
                Map<p, Object> map = this.h.get(string);
                if (map == null) {
                    WeakHashMap weakHashMap = new WeakHashMap();
                    this.h.put(string, weakHashMap);
                }
                var4_7.put(p2, null);
                if (this.a(var4_7.keySet())) {
                    for (p p3 : var4_7.keySet()) {
                        try {
                            if (p3.d()) continue;
                            p3.a(true);
                        }
                        catch (NullPointerException nullPointerException) {
                            throw SchemaManagerImpl.a(nullPointerException);
                        }
                    }
                } else {
                    block13: {
                        try {
                            if (var4_7.isEmpty()) break block13;
                            p2.a(false);
                            break block14;
                        }
                        catch (NullPointerException nullPointerException) {
                            throw SchemaManagerImpl.a(nullPointerException);
                        }
                    }
                    a.log(Level.FINE, u[20], string);
                    this.h.remove(string);
                }
            }
            set.add(p2);
        }
    }

    private boolean a(Collection<p> collection) {
        boolean bl2 = false;
        if (collection.size() > 1) {
            boolean bl3;
            int n2 = 0;
            for (p p2 : collection) {
                try {
                    try {
                        if (p2.isInclude() || ++n2 <= 1) continue;
                        break;
                    }
                    catch (NullPointerException nullPointerException) {
                        throw SchemaManagerImpl.a(nullPointerException);
                    }
                }
                catch (NullPointerException nullPointerException) {
                    throw SchemaManagerImpl.a(nullPointerException);
                }
            }
            try {
                bl3 = n2 > 1;
            }
            catch (NullPointerException nullPointerException) {
                throw SchemaManagerImpl.a(nullPointerException);
            }
            bl2 = bl3;
        }
        return bl2;
    }

    Lock e() {
        return this.f.readLock();
    }

    @Override
    public synchronized void registerSchema(String string, String string2, String string3) {
        block9: {
            SchemaResource schemaResource;
            block10: {
                try {
                    if (string3 == null) {
                        throw new NullPointerException(u[2]);
                    }
                }
                catch (NullPointerException nullPointerException) {
                    throw SchemaManagerImpl.a(nullPointerException);
                }
                SchemaResource schemaResource2 = new SchemaResource(string, string2, string3);
                schemaResource = this.i.put(string, schemaResource2);
                try {
                    if (schemaResource2.equals((Object)schemaResource)) break block9;
                    if (string2 == null) break block10;
                }
                catch (NullPointerException nullPointerException) {
                    throw SchemaManagerImpl.a(nullPointerException);
                }
                Set<SchemaResource> set = this.j.get(string2);
                if (set == null) {
                    set = new HashSet<SchemaResource>();
                    this.j.put(string2, set);
                }
                set.add(schemaResource2);
            }
            try {
                if (schemaResource != null) {
                    this.a(string);
                }
            }
            catch (NullPointerException nullPointerException) {
                throw SchemaManagerImpl.a(nullPointerException);
            }
        }
    }

    @Override
    public synchronized void unregisterSchema(String string) {
        SchemaResource schemaResource = this.i.remove(string);
        if (schemaResource != null) {
            String string2 = schemaResource.getTargetNamespace();
            if (string2 != null) {
                Set<SchemaResource> set = this.j.get(string2);
                try {
                    if (set != null) {
                        set.remove((Object)schemaResource);
                    }
                }
                catch (NullPointerException nullPointerException) {
                    throw SchemaManagerImpl.a(nullPointerException);
                }
            }
            this.a(string);
        }
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    @Override
    public void registerUri(String string) {
        Map<String, Integer> map = this.k;
        synchronized (map) {
            Integer n2 = this.k.get(string);
            if (n2 == null) {
                n2 = 0;
            }
            this.k.put(string, n2 + 1);
        }
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     * Loose catch block
     */
    @Override
    public void unregisterUri(String string) {
        Map<String, Integer> map = this.k;
        synchronized (map) {
            block8: {
                block7: {
                    Integer n2 = this.k.get(string);
                    if (n2 == null) break block7;
                    try {
                        block9: {
                            if (n2 <= 1) break block7;
                            break block9;
                            catch (NullPointerException nullPointerException) {
                                throw SchemaManagerImpl.a(nullPointerException);
                            }
                        }
                        this.k.put(string, n2 - 1);
                        break block8;
                    }
                    catch (NullPointerException nullPointerException) {
                        throw SchemaManagerImpl.a(nullPointerException);
                    }
                }
                this.k.remove(string);
            }
        }
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    @Override
    public boolean isSchemaRegistered(String string) {
        boolean bl2;
        block9: {
            p p2;
            HashSet<String> hashSet;
            block10: {
                Object object;
                block8: {
                    bl2 = false;
                    object = this.k;
                    synchronized (object) {
                        hashSet = new HashSet<String>(this.k.keySet());
                    }
                    try {
                        if (!hashSet.contains(string) && !this.i.containsKey(string)) break block8;
                    }
                    catch (NullPointerException nullPointerException) {
                        throw SchemaManagerImpl.a(nullPointerException);
                    }
                    bl2 = true;
                    break block9;
                }
                object = this.g.get(string);
                if (object == null) break block9;
                p2 = ((SchemaHandle)object).getTarget();
                try {
                    if (p2 == null) break block9;
                    if (p2.b()) break block10;
                }
                catch (NullPointerException nullPointerException) {
                    throw SchemaManagerImpl.a(nullPointerException);
                }
                bl2 = true;
                break block9;
            }
            for (p p3 : p2.f()) {
                if (!hashSet.contains(p3.getSystemId())) continue;
                bl2 = true;
                break;
            }
        }
        return bl2;
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    @Override
    public Set<String> getRequiredSchemaUris() {
        HashSet<String> hashSet;
        Map<String, Integer> map = this.k;
        synchronized (map) {
            hashSet = new HashSet<String>(this.k.keySet());
        }
        for (Map.Entry entry : this.i.entrySet()) {
            String[] stringArray;
            Object object;
            String string = (String)entry.getKey();
            try {
                if (!this.c(string)) {
                    hashSet.add(string);
                }
            }
            catch (URISyntaxException uRISyntaxException) {
                throw SchemaManagerImpl.a(uRISyntaxException);
            }
            boolean bl2 = false;
            SchemaHandle schemaHandle = this.g.get(entry.getKey());
            if (schemaHandle != null && (object = schemaHandle.getTarget()) != null) {
                bl2 = true;
                hashSet.addAll(((p)object).e().keySet());
            }
            if (bl2) continue;
            object = (SchemaResource)((Object)entry.getValue());
            try {
                Collection collection = SchemaUtil.getDependencies((InputSource)this.a((SchemaResource)((Object)object)), (EntityResolver)this.q);
                for (ResourceReference resourceReference : collection) {
                    if (resourceReference.getUri() == null) continue;
                    try {
                        URI uRI = new URI(resourceReference.getBaseUri());
                        hashSet.add(uRI.resolve(new URI(resourceReference.getUri())).toString());
                    }
                    catch (URISyntaxException uRISyntaxException) {
                        String string2 = ExceptionUtils.getMessage((Throwable)uRISyntaxException);
                        String string3 = resourceReference.getBaseUri();
                        String string4 = resourceReference.getUri();
                        stringArray = u;
                        a.log(Level.INFO, stringArray[42] + string4 + stringArray[44] + string3 + stringArray[12] + string2, ExceptionUtils.getDebugException((Throwable)uRISyntaxException));
                        hashSet.add(resourceReference.getUri());
                    }
                }
            }
            catch (SAXException sAXException) {
                stringArray = u;
                a.log(Level.INFO, stringArray[8] + ((SchemaResource)((Object)object)).getUri() + stringArray[49] + ExceptionUtils.getMessage((Throwable)sAXException), ExceptionUtils.getDebugException((Throwable)sAXException));
            }
            catch (IOException iOException) {
                stringArray = u;
                a.log(Level.INFO, stringArray[8] + ((SchemaResource)((Object)object)).getUri() + stringArray[49] + ExceptionUtils.getMessage((Throwable)iOException), ExceptionUtils.getDebugException((Throwable)iOException));
            }
        }
        return hashSet;
    }

    @Override
    public Set<String> getRequiredSchemaTargetNamespaces() {
        HashSet<String> hashSet = new HashSet<String>();
        for (Map.Entry<String, SchemaResource> entry : this.i.entrySet()) {
            String[] stringArray;
            Object object;
            Object object2;
            boolean bl2 = this.c(entry.getKey());
            boolean bl3 = false;
            SchemaHandle schemaHandle = this.g.get(entry.getKey());
            if (schemaHandle != null && (object2 = schemaHandle.getTarget()) != null) {
                bl3 = true;
                try {
                    if (!bl2) {
                        hashSet.add(((p)object2).getTargetNamespace());
                    }
                }
                catch (SAXException sAXException) {
                    throw SchemaManagerImpl.a(sAXException);
                }
                for (String string : ((p)object2).e().keySet()) {
                    object = this.g.get(string);
                    if (object == null) continue;
                    p p2 = ((SchemaHandle)object).getTarget();
                    try {
                        if (p2 == null) continue;
                        hashSet.add(p2.getTargetNamespace());
                    }
                    catch (SAXException sAXException) {
                        throw SchemaManagerImpl.a(sAXException);
                    }
                }
            }
            if (bl3) continue;
            object2 = entry.getValue();
            try {
                try {
                    if (!bl2) {
                        hashSet.add(XmlUtil.getSchemaTNS((String)((SchemaResource)((Object)object2)).getContent()));
                    }
                }
                catch (SAXException sAXException) {
                    throw SchemaManagerImpl.a(sAXException);
                }
                Collection collection = SchemaUtil.getDependencies((InputSource)this.a((SchemaResource)((Object)object2)), (EntityResolver)this.q);
                Iterator iterator = collection.iterator();
                while (iterator.hasNext()) {
                    object = (ResourceReference)iterator.next();
                    try {
                        if (!object.hasTargetNamespace()) continue;
                        hashSet.add(object.getTargetNamespace());
                    }
                    catch (SAXException sAXException) {
                        throw SchemaManagerImpl.a(sAXException);
                    }
                }
            }
            catch (SAXException sAXException) {
                stringArray = u;
                a.log(Level.INFO, stringArray[1] + ((SchemaResource)((Object)object2)).getUri() + stringArray[7] + ExceptionUtils.getMessage((Throwable)sAXException), ExceptionUtils.getDebugException((Throwable)sAXException));
            }
            catch (IOException iOException) {
                stringArray = u;
                a.log(Level.INFO, stringArray[8] + ((SchemaResource)((Object)object2)).getUri() + stringArray[49] + ExceptionUtils.getMessage((Throwable)iOException), ExceptionUtils.getDebugException((Throwable)iOException));
            }
            catch (XmlUtil.BadSchemaException badSchemaException) {
                stringArray = u;
                a.log(Level.INFO, stringArray[8] + ((SchemaResource)((Object)object2)).getUri() + stringArray[49] + ExceptionUtils.getMessage((Throwable)badSchemaException), ExceptionUtils.getDebugException((Throwable)badSchemaException));
            }
        }
        return hashSet;
    }

    @Override
    public boolean invalidateSchemaByUri(String string, boolean bl2) {
        boolean bl3;
        block2: {
            bl3 = false;
            try {
                if (!bl2 && !this.a(string, System.currentTimeMillis())) break block2;
            }
            catch (NullPointerException nullPointerException) {
                throw SchemaManagerImpl.a(nullPointerException);
            }
            this.a(string);
            bl3 = true;
        }
        return bl3;
    }

    @ManagedAttribute(description="Schema Cache Size", currencyTimeLimit=5)
    public int getSchemaCacheSize() {
        return this.g.size();
    }

    @ManagedOperation(description="Schema Cache Keys")
    public Set<String> getSchemaCacheUris() {
        return new TreeSet<String>(this.g.keySet());
    }

    @ManagedAttribute(description="Registered Schema Size", currencyTimeLimit=5)
    public int getRegisteredSchemaSize() {
        return this.i.size();
    }

    @ManagedOperation(description="Registered Schema Keys")
    public Set<String> getRegisteredSchemaUris() {
        return new TreeSet<String>(this.i.keySet());
    }

    private static String a(String string, String string2) {
        return SchemaManagerImpl.a(string, string2, null, null);
    }

    private static String a(String string, String string2, String string3, String string4) {
        Object object;
        if (string2 != null) {
            String string5 = string2;
            if (string != null) {
                try {
                    string5 = new URI(string).resolve(string2).toString();
                }
                catch (URISyntaxException uRISyntaxException) {
                    try {
                        if (a.isLoggable(Level.FINE)) {
                            a.log(Level.FINE, u[18], new String[]{string2, string});
                        }
                    }
                    catch (URISyntaxException uRISyntaxException2) {
                        throw SchemaManagerImpl.a(uRISyntaxException2);
                    }
                }
                catch (IllegalArgumentException illegalArgumentException) {
                    try {
                        if (a.isLoggable(Level.FINE)) {
                            a.log(Level.FINE, u[9], new String[]{string2, string});
                        }
                    }
                    catch (URISyntaxException uRISyntaxException) {
                        throw SchemaManagerImpl.a(uRISyntaxException);
                    }
                }
            }
            String[] stringArray = u;
            object = stringArray[24] + string5;
        } else if (string3 != null) {
            String[] stringArray = u;
            object = stringArray[27] + string3;
        } else if (string4 != null) {
            String[] stringArray = u;
            object = stringArray[30] + string4;
        } else {
            object = u[17];
        }
        return object;
    }

    private Set<String> a(Audit audit, SchemaSourceResolver.SchemaSource schemaSource) throws SAXException, IOException {
        HashSet<String> hashSet = new HashSet<String>();
        HashSet<String> hashSet2 = new HashSet<String>();
        try {
            if (!this.e(schemaSource.getResolverId())) {
                hashSet2.add(schemaSource.getUri());
            }
        }
        catch (RuntimeException runtimeException) {
            throw SchemaManagerImpl.a(runtimeException);
        }
        SchemaFactory schemaFactory = SchemaFactory.newInstance(XmlUtil.W3C_XML_SCHEMA);
        i i2 = new i(this, hashSet2, audit, schemaSource, hashSet);
        schemaFactory.setResourceResolver(i2);
        try {
            schemaFactory.newSchema(this.o.get().makeSource(schemaSource));
            return hashSet;
        }
        catch (RuntimeException runtimeException) {
            UnresolvableException unresolvableException = (UnresolvableException)ExceptionUtils.getCauseIfCausedBy((Throwable)runtimeException, UnresolvableException.class);
            try {
                if (unresolvableException != null) {
                    throw new CausedIOException(u[11] + unresolvableException.getResourceDescription() + u[26] + ExceptionUtils.getMessage((Throwable)unresolvableException.getCause()), unresolvableException.getCause());
                }
            }
            catch (RuntimeException runtimeException2) {
                throw SchemaManagerImpl.a(runtimeException2);
            }
            throw runtimeException;
        }
    }

    private String a(Audit audit, String string) throws IOException {
        for (SchemaSourceResolver schemaSourceResolver : this.p) {
            if (schemaSourceResolver.isRemote()) continue;
            SchemaSourceResolver.SchemaSource schemaSource = schemaSourceResolver.getSchemaByTargetNamespace(audit, string);
            try {
                if (schemaSource == null) continue;
                return schemaSource.getUri();
            }
            catch (IOException iOException) {
                throw SchemaManagerImpl.a(iOException);
            }
        }
        return null;
    }

    private boolean e(String string) throws IOException {
        boolean bl2 = false;
        for (SchemaSourceResolver schemaSourceResolver : this.p) {
            if (!schemaSourceResolver.getId().equals(string)) continue;
            bl2 = schemaSourceResolver.isRemote();
            break;
        }
        return bl2;
    }

    /*
     * Loose catch block
     * Enabled force condition propagation
     * Lifted jumps to return sites
     */
    private String b(String string, String string2) throws IOException {
        block6: {
            if (string == null) throw new NullPointerException();
            try {
                if (string2 != null) break block6;
                throw new NullPointerException();
                catch (URISyntaxException uRISyntaxException) {
                    throw SchemaManagerImpl.a(uRISyntaxException);
                }
            }
            catch (URISyntaxException uRISyntaxException) {
                throw SchemaManagerImpl.a(uRISyntaxException);
            }
        }
        try {
            URI uRI = new URI(string2);
            URI uRI2 = new URI(string);
            return uRI2.resolve(uRI).toString();
        }
        catch (URISyntaxException uRISyntaxException) {
            throw new IOException(uRISyntaxException);
        }
    }

    private SchemaHandle a(Audit audit, String string, SchemaSourceResolver.SchemaSource schemaSource) throws SAXException, IOException {
        this.a(audit, schemaSource);
        this.f();
        SchemaHandle schemaHandle = this.a(audit, string, schemaSource, new HashSet<String>());
        this.b(schemaHandle.getTarget());
        return schemaHandle;
    }

    private void f() {
        while (!this.l.isEmpty()) {
            ArrayList<String> arrayList = new ArrayList<String>(this.l.keySet());
            this.l.clear();
            for (String string : arrayList) {
                HashSet<p> hashSet = new HashSet<p>();
                this.a(string, hashSet);
                for (p p2 : hashSet) {
                    try {
                        if (p2.isClosed()) continue;
                        this.a(p2.getSystemId());
                    }
                    catch (NullPointerException nullPointerException) {
                        throw SchemaManagerImpl.a(nullPointerException);
                    }
                }
            }
        }
    }

    /*
     * Loose catch block
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     */
    private SchemaHandle a(Audit audit, String string, SchemaSourceResolver.SchemaSource schemaSource, Set<String> set) throws SAXException, IOException {
        AbstractCloseable abstractCloseable;
        try {
            if (set.contains(string)) {
                a.info(u[10]);
                return null;
            }
        }
        catch (XmlUtil.BadSchemaException badSchemaException) {
            throw SchemaManagerImpl.a((Exception)((Object)badSchemaException));
        }
        String string2 = schemaSource.getContent();
        set.add(string);
        SchemaFactory schemaFactory = SchemaFactory.newInstance(XmlUtil.W3C_XML_SCHEMA);
        Document document = XmlUtil.parse((InputSource)this.o.get().makeInputSource(schemaSource), (EntityResolver)this.n.get());
        HashSet hashSet = new HashSet();
        DocumentReferenceProcessor documentReferenceProcessor = DocumentReferenceProcessor.schemaProcessor();
        documentReferenceProcessor.processDocumentReferences(document, (DocumentReferenceProcessor.ReferenceCustomizer)new j(this, hashSet));
        HashMap<String, SchemaHandle> hashMap = new HashMap<String, SchemaHandle>();
        HashMap<String, SchemaHandle> hashMap2 = new HashMap<String, SchemaHandle>();
        k k2 = new k(this, hashSet, hashMap2, hashMap, audit, set, schemaSource);
        schemaFactory.setResourceResolver(k2);
        boolean bl2 = false;
        try {
            SchemaHandle schemaHandle2222222;
            Schema schema = schemaFactory.newSchema(this.o.get().makeSource(schemaSource));
            String string3 = XmlUtil.getSchemaTNS((String)string, (String)string2, (EntityResolver)this.n.get());
            Element element = DomUtils.normalizeNamespaces((Element)document.getDocumentElement());
            p p2 = new p(string3, string, string2, schemaSource.getResolverId(), element, schema, this, hashMap, hashMap2, schemaSource.isTransient());
            for (SchemaHandle schemaHandle2222222 : CollectionUtils.iterable((Iterable[])new Iterable[]{hashMap.values(), hashMap2.values()})) {
                abstractCloseable = schemaHandle2222222.b();
                try {
                    if (abstractCloseable == null) {
                        continue;
                    }
                }
                catch (XmlUtil.BadSchemaException badSchemaException) {
                    throw SchemaManagerImpl.a((Exception)((Object)badSchemaException));
                }
                abstractCloseable.a(p2);
            }
            SchemaHandle schemaHandle3 = p2.ref();
            schemaHandle2222222 = this.g.put(p2.getSystemId(), schemaHandle3);
            try {
                if (schemaHandle2222222 != null) {
                    this.a(schemaHandle2222222);
                }
            }
            catch (XmlUtil.BadSchemaException badSchemaException) {
                throw SchemaManagerImpl.a((Exception)((Object)badSchemaException));
            }
            bl2 = true;
            abstractCloseable = p2.ref();
            if (bl2) return abstractCloseable;
        }
        catch (XmlUtil.BadSchemaException badSchemaException) {
            try {
                String[] stringArray = u;
                throw new SAXException(stringArray[33], (Exception)((Object)badSchemaException));
                catch (RuntimeException runtimeException) {
                    UnresolvableException unresolvableException = (UnresolvableException)ExceptionUtils.getCauseIfCausedBy((Throwable)runtimeException, UnresolvableException.class);
                    try {
                        if (unresolvableException == null) throw runtimeException;
                        throw new CausedIOException(u[19] + unresolvableException.getResourceDescription() + u[31] + ExceptionUtils.getMessage((Throwable)unresolvableException.getCause()), unresolvableException.getCause());
                    }
                    catch (XmlUtil.BadSchemaException badSchemaException2) {
                        throw SchemaManagerImpl.a((Exception)((Object)badSchemaException2));
                    }
                }
            }
            catch (Throwable throwable) {
                if (bl2) throw throwable;
                Iterator iterator = CollectionUtils.iterable((Iterable[])new Iterable[]{hashMap.values(), hashMap2.values()}).iterator();
                while (iterator.hasNext()) {
                    SchemaHandle schemaHandle = (SchemaHandle)iterator.next();
                    schemaHandle.close();
                }
                throw throwable;
            }
        }
        Iterator iterator = CollectionUtils.iterable((Iterable[])new Iterable[]{hashMap.values(), hashMap2.values()}).iterator();
        while (iterator.hasNext()) {
            SchemaHandle schemaHandle = (SchemaHandle)iterator.next();
            schemaHandle.close();
        }
        return abstractCloseable;
    }

    private SchemaSourceResolver.SchemaSource a(Audit audit, String string, String string2, String string3, Set<String> set, Map<String, SchemaHandle> map, boolean bl2) throws IOException, SAXException {
        SchemaSourceResolver.SchemaSource schemaSource;
        block7: {
            schemaSource = null;
            if (string2 != null) {
                schemaSource = this.a(audit, string3, string2, false, false, bl2, false);
            }
            if (schemaSource == null) {
                schemaSource = this.a(audit, string3, string, false, false, bl2);
            }
            try {
                try {
                    if (t || schemaSource != null) break block7;
                }
                catch (IOException iOException) {
                    throw SchemaManagerImpl.a(iOException);
                }
                throw new AssertionError();
            }
            catch (IOException iOException) {
                throw SchemaManagerImpl.a(iOException);
            }
        }
        SchemaHandle schemaHandle = this.g.get(schemaSource.getUri());
        schemaHandle = schemaHandle == null ? this.a(audit, schemaSource.getUri(), schemaSource, set) : schemaHandle.b().ref();
        if (schemaHandle != null) {
            p p2 = schemaHandle.b();
            map.put(p2.getSystemId(), schemaHandle);
            return new SchemaSourceResolver.DefaultSchemaSource(p2.getSystemId(), p2.c(), p2.j(), p2.isTransientSchema());
        }
        return schemaSource;
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     * Loose catch block
     */
    void c(p p2) {
        block15: {
            this.g();
            String[] stringArray = u;
            a.log(Level.FINE, stringArray[38], p2);
            String string = this.a(p2);
            this.f.writeLock().lock();
            try {
                Map<p, Object> map;
                block16: {
                    block14: {
                        SchemaHandle schemaHandle = this.g.get(p2.getSystemId());
                        if (schemaHandle == null) break block14;
                        try {
                            block17: {
                                if (schemaHandle.getTarget() != p2) break block14;
                                break block17;
                                catch (NullPointerException nullPointerException) {
                                    throw SchemaManagerImpl.a(nullPointerException);
                                }
                            }
                            this.g.remove(p2.getSystemId());
                            this.l.put(p2.getSystemId(), 1);
                        }
                        catch (NullPointerException nullPointerException) {
                            throw SchemaManagerImpl.a(nullPointerException);
                        }
                    }
                    map = this.h.get(string);
                    if (map == null) {
                        return;
                    }
                    map.remove(p2);
                    if (this.a(map.keySet())) break block15;
                    try {
                        block18: {
                            if (!a.isLoggable(Level.INFO)) break block16;
                            break block18;
                            catch (NullPointerException nullPointerException) {
                                throw SchemaManagerImpl.a(nullPointerException);
                            }
                        }
                        a.log(Level.INFO, u[47], string);
                    }
                    catch (NullPointerException nullPointerException) {
                        throw SchemaManagerImpl.a(nullPointerException);
                    }
                }
                for (p p3 : map.keySet()) {
                    p3.a(false);
                }
            }
            finally {
                this.f.writeLock().unlock();
            }
        }
    }

    private void c(p p2, Set<p> set) {
        Set<p> set2 = p2.f();
        boolean bl2 = false;
        for (p p3 : set2) {
            try {
                if (p3 == null) {
                    continue;
                }
            }
            catch (NullPointerException nullPointerException) {
                throw SchemaManagerImpl.a(nullPointerException);
            }
            bl2 = true;
            this.c(p3, set);
        }
        try {
            if (!bl2) {
                set.add(p2);
            }
        }
        catch (NullPointerException nullPointerException) {
            throw SchemaManagerImpl.a(nullPointerException);
        }
    }

    private void a(p p2, Set<p> set, StringBuilder stringBuilder, String string) {
        set.add(p2);
        stringBuilder.append(string).append(p2);
        try {
            for (int i2 = string.length(); i2 < 14; ++i2) {
                stringBuilder.append(" ");
            }
        }
        catch (NullPointerException nullPointerException) {
            throw SchemaManagerImpl.a(nullPointerException);
        }
        stringBuilder.append(p2.g()).append("\n");
        Map<String, SchemaHandle> map = p2.e();
        for (SchemaHandle schemaHandle : map.values()) {
            p p3 = schemaHandle.getTarget();
            try {
                if (p3 == null) continue;
                this.a(p3, set, stringBuilder, u[34] + string);
            }
            catch (NullPointerException nullPointerException) {
                throw SchemaManagerImpl.a(nullPointerException);
            }
        }
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     * Could not resolve type clashes
     * Loose catch block
     */
    private void g() {
        try {
            if (!a.isLoggable(Level.FINEST)) {
                return;
            }
        }
        catch (NullPointerException nullPointerException) {
            throw SchemaManagerImpl.a(nullPointerException);
        }
        String[] stringArray = u;
        StringBuilder stringBuilder = new StringBuilder(stringArray[40]);
        HashSet<p> hashSet = new HashSet<p>();
        HashSet<p> hashSet2 = new HashSet<p>();
        this.f.readLock().lock();
        try {
            Object object;
            Collection<SchemaHandle> collection = this.g.values();
            for (Object object2 : collection) {
                try {
                    if (object2 == null) {
                        continue;
                    }
                }
                catch (NullPointerException nullPointerException) {
                    throw SchemaManagerImpl.a(nullPointerException);
                }
                object = ((SchemaHandle)object2).getTarget();
                try {
                    if (object == null) {
                        continue;
                    }
                }
                catch (NullPointerException nullPointerException) {
                    throw SchemaManagerImpl.a(nullPointerException);
                }
                this.c((p)object, hashSet);
            }
            for (Object object2 : hashSet) {
                stringArray = u;
                this.a((p)object2, hashSet2, stringBuilder, stringArray[39]);
            }
            for (Object object2 : collection) {
                try {
                    if (object2 == null) {
                        continue;
                    }
                }
                catch (NullPointerException nullPointerException) {
                    throw SchemaManagerImpl.a(nullPointerException);
                }
                object = ((SchemaHandle)object2).getTarget();
                try {
                    if (object == null) {
                        continue;
                    }
                }
                catch (NullPointerException nullPointerException) {
                    throw SchemaManagerImpl.a(nullPointerException);
                }
                try {
                    if (hashSet2.contains(object)) continue;
                    this.a((p)object, hashSet2, stringBuilder, u[35]);
                }
                catch (NullPointerException nullPointerException) {
                    throw SchemaManagerImpl.a(nullPointerException);
                }
            }
            stringArray = u;
            stringBuilder.append(stringArray[48]);
            for (Object object2 : this.h.entrySet()) {
                object = (String)object2.getKey();
                Map map = (Map)object2.getValue();
                if (object == null || map == null) continue;
                try {
                    if (map.isEmpty()) {
                        continue;
                    }
                }
                catch (NullPointerException nullPointerException) {
                    throw SchemaManagerImpl.a(nullPointerException);
                }
                stringArray = u;
                stringBuilder.append(stringArray[29]).append((String)object).append("\n");
                for (p p2 : map.keySet()) {
                    String string;
                    block36: {
                        block35: {
                            try {
                                if (p2 == null) {
                                    continue;
                                }
                            }
                            catch (NullPointerException nullPointerException) {
                                throw SchemaManagerImpl.a(nullPointerException);
                            }
                            SchemaHandle schemaHandle = this.g.get(p2.getSystemId());
                            if (schemaHandle == null) break block35;
                            try {
                                block38: {
                                    if (schemaHandle.getTarget() != p2) break block35;
                                    break block38;
                                    catch (NullPointerException nullPointerException) {
                                        throw SchemaManagerImpl.a(nullPointerException);
                                    }
                                }
                                string = "*";
                                break block36;
                            }
                            catch (NullPointerException nullPointerException) {
                                throw SchemaManagerImpl.a(nullPointerException);
                            }
                        }
                        string = " ";
                    }
                    String string2 = string;
                    stringArray = u;
                    stringBuilder.append(stringArray[41]).append(string2).append(p2).append("\n");
                }
            }
        }
        finally {
            this.f.readLock().unlock();
        }
        stringBuilder.append(u[14]);
        a.finest(stringBuilder.toString());
    }

    /*
     * Unable to fully structure code
     */
    static {
        block12: {
            block11: {
                var5 = new String[51];
                var3_1 = 0;
                var2_2 = "\u001c9HS\u0001mj,;C^\t,'.3NB\tb+!9E\u001c\u001a4AT\u0000ij;5\u0000F\r~9*zx{ ,\u0019,2E[\r,m\u0019\u000ezSU\u0004i'.zMC\u001fxj-?\u0000F\u001ec<&>ER(\u001a4AT\u0000ij;5\u0000D\t\u007f%#,E\u0016\u001fo\"*7A\u0016\nc8o4A[\t\u007f:.9E\fL.\u001c9HS\u0001mj,;C^\t,)#5S_\u0002kj4j]\u0016\u0019b?<?D\u0016\u001fo\"*7A\u0016\u0004m$+6EE),5M\u0018\u0000;>*9H\u0018\u001fi89?R\u0018\u001fo\"*7A\u0018\u0001e$\f6EW\u0002y:\u001f?R_\u0003h$,5M\u0018\u0000;>*9H\u0018\u001fi89?R\u0018\u001fo\"*7A\u0018\r`& -rS\u0001c>*,hv\u0000R\t|/!>EX\u000fuj&4FYLb%;zA@\re&.8LS@,/=(ODLe9uz\u001c\u001a4AT\u0000ij;5\u0000F\r~9*zx{ ,\u0019,2E[\r,m<\u001a4AT\u0000ij;5\u0000D\t\u007f%#,E\u0016\u0019~#o}\u0007M\\qmhv\u0000D\t`+;3VSLx%o8AE\t,?=3\u0000\u0011Kw{2}\u0007\u0018\u0019\f3RU\u0019`+=zI[\u001cc8;zDS\u0018i);?D\u0018*\u001a4AT\u0000ij;5\u0000D\t\u007f%#,E\u0016\bi:*4DS\u0002o3o<ODL~/<5UD\u000fij\rhv\u0000S\u001e~%=zIEV,\u0007?5L_\u000fup\u0002EP*\u001c9HS\u0001mj\u001a\bi\u0016\u0002c>o*ED\u0001e>;?D\u0016\u0005bj;2IELo%!.EN\u00186j!\u001d?MY\u0018ij=?SY\u0019~)*zAU\u000fi9<zFY\u001en#+>EXB\u0007\u001a4KX\u0003{$<\u001a4AT\u0000ij;5\u0000D\t\u007f%#,E\u0016\u0019~#o}\u0007M\\qmhv\u0000D\t`+;3VSLx%o8AE\t,?=3\u0000\u0011Kw{2}\u0007\u0018*\u001a4AT\u0000ij;5\u0000D\t\u007f%#,E\u0016\bi:*4DS\u0002o3o<ODL~/<5UD\u000fij(\u00015\u0000[\u0003~/o)C^\ta+<zW_\u0018dj;;RQ\tx\u0004.7EE\u001cm)*z[\u0006\u00116\u000b5CC\u0001i$;zRS\ni8=?D\u0016\u0018cj.4\u0000S\u0014x/=4AZLi$;3TOL{#;2\u0000E\u0015\u007f>*7\u0000_\b*\u001d/NX\u0005b-o*ED\u0005c.&9\u0000E\u000fd/\";\u0000U\ro\"*zCZ\tm$:*\u0000B\r\u007f! \n(RY\u001e,+,9EE\u001fe$(zSU\u0004i'.zFY\u001e,?=3\u0000\u0011\u0004\u001a\bi\f<\u001d?BC\u0005`.&4G\u0016\u001fo\"*7A\u0016\u000fm)'?\u0000R\u0019ij;5\u0000U\u0004m$(?\u0000_\u0002,).9HSLo%!<IQ\u0019~+;3OX\u0003o`\u0000\t\u001f/BZ\u0005o\u0003\u000b`\u0005\u0014>TR1\u0006oztx?6\n\u0001;MS\u001f|+,?\u001a\u0003o`\u0000\u0003h`\u0000\u0016\u001a4AT\u0000ij;5\u0000F\r~9*zsU\u0004i'.\u0004oz\u0000\u0016\u0002pw\u001d?5L_\u000fup.)SS\u001ex# 4\u001aE\u000fd/\";VW\u000069.)\u00064VW\u0000e...IX\u000b,).9HS\b,9,2E[\r,=&.H\u0016\u001fu9;?M\u007f\b,\u000b\f6OE\u0005b-o!\u0010K\u0002ow\u001bEPsU\u0004i'.zCW\u000fd/o9OX\u0018i$;)\u001a\u0016f\u0006\u0007oz\u0000\u0016L,j\u0013\u001a4AT\u0000ij;5\u0000D\t\u007f%#,E\u0016K\u0019\u001a4AT\u0000ij;5\u0000D\t\u007f%#,E\u0016\u001fo\"*7A\u0016\fhv\u0000W\u000bm#!)T\u0016K+,5M\u0018\u0000;>*9H\u0018\u001fi89?R\u0018\u001fo\"*7A\u0018\u001fx8&9Tr\u0003o>6*Eu\u0004i)$%\n(RY\u001e,='3LSL~/-/IZ\be$(zSU\u0004i'.zCW\u000fd/uzK\u001d?MW\u0005b#!=\u0000E\u000fd/\";S\u0016\u001be>'zTX\u001f,h4j]\u0014Lm8*zNY\u001b,/#3G_\u000e`/o<ODLd+=>WW\u001eij.9CS\u0000i8..IY\u0002\rEPtx?,).9HSV\u0006";
                var4_3 = "\u001c9HS\u0001mj,;C^\t,'.3NB\tb+!9E\u001c\u001a4AT\u0000ij;5\u0000F\r~9*zx{ ,\u0019,2E[\r,m\u0019\u000ezSU\u0004i'.zMC\u001fxj-?\u0000F\u001ec<&>ER(\u001a4AT\u0000ij;5\u0000D\t\u007f%#,E\u0016\u001fo\"*7A\u0016\nc8o4A[\t\u007f:.9E\fL.\u001c9HS\u0001mj,;C^\t,)#5S_\u0002kj4j]\u0016\u0019b?<?D\u0016\u001fo\"*7A\u0016\u0004m$+6EE),5M\u0018\u0000;>*9H\u0018\u001fi89?R\u0018\u001fo\"*7A\u0018\u0001e$\f6EW\u0002y:\u001f?R_\u0003h$,5M\u0018\u0000;>*9H\u0018\u001fi89?R\u0018\u001fo\"*7A\u0018\r`& -rS\u0001c>*,hv\u0000R\t|/!>EX\u000fuj&4FYLb%;zA@\re&.8LS@,/=(ODLe9uz\u001c\u001a4AT\u0000ij;5\u0000F\r~9*zx{ ,\u0019,2E[\r,m<\u001a4AT\u0000ij;5\u0000D\t\u007f%#,E\u0016\u0019~#o}\u0007M\\qmhv\u0000D\t`+;3VSLx%o8AE\t,?=3\u0000\u0011Kw{2}\u0007\u0018\u0019\f3RU\u0019`+=zI[\u001cc8;zDS\u0018i);?D\u0018*\u001a4AT\u0000ij;5\u0000D\t\u007f%#,E\u0016\bi:*4DS\u0002o3o<ODL~/<5UD\u000fij\rhv\u0000S\u001e~%=zIEV,\u0007?5L_\u000fup\u0002EP*\u001c9HS\u0001mj\u001a\bi\u0016\u0002c>o*ED\u0001e>;?D\u0016\u0005bj;2IELo%!.EN\u00186j!\u001d?MY\u0018ij=?SY\u0019~)*zAU\u000fi9<zFY\u001en#+>EXB\u0007\u001a4KX\u0003{$<\u001a4AT\u0000ij;5\u0000D\t\u007f%#,E\u0016\u0019~#o}\u0007M\\qmhv\u0000D\t`+;3VSLx%o8AE\t,?=3\u0000\u0011Kw{2}\u0007\u0018*\u001a4AT\u0000ij;5\u0000D\t\u007f%#,E\u0016\bi:*4DS\u0002o3o<ODL~/<5UD\u000fij(\u00015\u0000[\u0003~/o)C^\ta+<zW_\u0018dj;;RQ\tx\u0004.7EE\u001cm)*z[\u0006\u00116\u000b5CC\u0001i$;zRS\ni8=?D\u0016\u0018cj.4\u0000S\u0014x/=4AZLi$;3TOL{#;2\u0000E\u0015\u007f>*7\u0000_\b*\u001d/NX\u0005b-o*ED\u0005c.&9\u0000E\u000fd/\";\u0000U\ro\"*zCZ\tm$:*\u0000B\r\u007f! \n(RY\u001e,+,9EE\u001fe$(zSU\u0004i'.zFY\u001e,?=3\u0000\u0011\u0004\u001a\bi\f<\u001d?BC\u0005`.&4G\u0016\u001fo\"*7A\u0016\u000fm)'?\u0000R\u0019ij;5\u0000U\u0004m$(?\u0000_\u0002,).9HSLo%!<IQ\u0019~+;3OX\u0003o`\u0000\t\u001f/BZ\u0005o\u0003\u000b`\u0005\u0014>TR1\u0006oztx?6\n\u0001;MS\u001f|+,?\u001a\u0003o`\u0000\u0003h`\u0000\u0016\u001a4AT\u0000ij;5\u0000F\r~9*zsU\u0004i'.\u0004oz\u0000\u0016\u0002pw\u001d?5L_\u000fup.)SS\u001ex# 4\u001aE\u000fd/\";VW\u000069.)\u00064VW\u0000e...IX\u000b,).9HS\b,9,2E[\r,=&.H\u0016\u001fu9;?M\u007f\b,\u000b\f6OE\u0005b-o!\u0010K\u0002ow\u001bEPsU\u0004i'.zCW\u000fd/o9OX\u0018i$;)\u001a\u0016f\u0006\u0007oz\u0000\u0016L,j\u0013\u001a4AT\u0000ij;5\u0000D\t\u007f%#,E\u0016K\u0019\u001a4AT\u0000ij;5\u0000D\t\u007f%#,E\u0016\u001fo\"*7A\u0016\fhv\u0000W\u000bm#!)T\u0016K+,5M\u0018\u0000;>*9H\u0018\u001fi89?R\u0018\u001fo\"*7A\u0018\u001fx8&9Tr\u0003o>6*Eu\u0004i)$%\n(RY\u001e,='3LSL~/-/IZ\be$(zSU\u0004i'.zCW\u000fd/uzK\u001d?MW\u0005b#!=\u0000E\u000fd/\";S\u0016\u001be>'zTX\u001f,h4j]\u0014Lm8*zNY\u001b,/#3G_\u000e`/o<ODLd+=>WW\u001eij.9CS\u0000i8..IY\u0002\rEPtx?,).9HSV\u0006".length();
                var1_4 = 24;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = SchemaManagerImpl.a(v0, SchemaManagerImpl.f(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "ZD2`;N\u001d\u0013\fwj=GX\u0014\u0006tk~P\u0017\tHsr?W\u0014\u001c\n~ar\u001e\u001d\u000f\u001a}v~W\u000bGHb(\u001bw$1XX\u0019\u0007qq3[\u0016\tHf}.[X\u0019\rtm0W\f\u0014\u0007|w~W\u0016]0_H~m\u001b\u0015\r\u007fe-\u001e\u0011\u000eHvm-_\u001a\u0011\rv$vM\u001b\u0015\r\u007fep_\u0014\u0011\u0007e@1]\f\u0004\u0018w$=R\r\u000e\u001cwv~N\n\u0012\u0018wv*GQ";
                    var4_3 = "ZD2`;N\u001d\u0013\fwj=GX\u0014\u0006tk~P\u0017\tHsr?W\u0014\u001c\n~ar\u001e\u001d\u000f\u001a}v~W\u000bGHb(\u001bw$1XX\u0019\u0007qq3[\u0016\tHf}.[X\u0019\rtm0W\f\u0014\u0007|w~W\u0016]0_H~m\u001b\u0015\r\u007fe-\u001e\u0011\u000eHvm-_\u001a\u0011\rv$vM\u001b\u0015\r\u007fep_\u0014\u0011\u0007e@1]\f\u0004\u0018w$=R\r\u000e\u001cwv~N\n\u0012\u0018wv*GQ".length();
                    var1_4 = 44;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 29;
                        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++] = SchemaManagerImpl.a(v0, SchemaManagerImpl.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;
            }
        }
        SchemaManagerImpl.u = var5;
        try {
            v5 = SchemaManagerImpl.class.desiredAssertionStatus() == false;
        }
        catch (NullPointerException v6) {
            throw SchemaManagerImpl.a(v6);
        }
        SchemaManagerImpl.t = v5;
        SchemaManagerImpl.a = Logger.getLogger(SchemaManagerImpl.class.getName());
        var0_6 = SchemaManagerImpl.u;
        SchemaManagerImpl.b = ConfigFactory.getLongProperty((String)var0_6[5], (long)5000L);
        SchemaManagerImpl.c = ConfigFactory.getBooleanProperty((String)var0_6[6], (boolean)false);
        SchemaManagerImpl.d = ConfigFactory.getBooleanProperty((String)var0_6[45], (boolean)true);
    }

    private static Exception a(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] ^ 0x65);
        }
        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 -> 96;
                    case 1 -> 117;
                    case 2 -> 15;
                    case 3 -> 25;
                    case 4 -> 67;
                    case 5 -> 35;
                    default -> 101;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }

    private static class UnresolvableException
    extends RuntimeException {
        private final String resourceDescription;
        static final long serialVersionUID = 3872515791357272531L;
        private static final String a = UnresolvableException.a(121, UnresolvableException.a("\u000e)M'S4\u001d/(\f7Z\"R71IeM4N42^&Zq"));

        private UnresolvableException(Throwable throwable, String string) {
            super(throwable);
            this.resourceDescription = string;
        }

        @Override
        public String getMessage() {
            return a + this.resourceDescription;
        }

        public String getResourceDescription() {
            return this.resourceDescription;
        }

        private static char[] a(String string) {
            char[] cArray = string.toCharArray();
            if (cArray.length < 2) {
                cArray = cArray;
                cArray[0] = (char)(cArray[0] ^ 0x44);
            }
            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 -> 34;
                        case 1 -> 62;
                        case 2 -> 85;
                        case 3 -> 60;
                        case 4 -> 70;
                        case 5 -> 40;
                        default -> 68;
                    })));
                    ++n3;
                    n4 = n4;
                } while (n4 > n3);
            }
            return new String(cArray2).intern();
        }
    }

    private static final class SchemaResource
    extends Triple<String, String, String> {
        static final long serialVersionUID = 1888801943819837180L;

        private SchemaResource(String string, String string2, String string3) {
            super((Object)string, (Object)string2, (Object)string3);
        }

        public String getUri() {
            return (String)this.left;
        }

        public String getTargetNamespace() {
            return (String)this.middle;
        }

        public String getContent() {
            return (String)this.right;
        }
    }
}

