/*
 * Decompiled with CFR 0_110.
 * 
 * Could not load the following classes:
 *  java.io.PrintStream
 *  java.lang.Exception
 *  java.lang.Object
 *  java.lang.String
 *  java.lang.StringBuffer
 *  java.lang.System
 *  java.lang.Throwable
 *  org.xml.sax.SAXException
 *  org.xml.sax.SAXNotRecognizedException
 *  org.xml.sax.SAXNotSupportedException
 *  org.xml.sax.XMLReader
 *  org.xml.sax.helpers.XMLReaderFactory
 */
package org.dom4j.io;

import java.io.PrintStream;
import org.dom4j.io.JAXPHelper;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;

class SAXHelper {
    private static boolean loggedWarning = true;

    protected SAXHelper() {
    }

    /*
     * Loose catch block
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     * Lifted jumps to return sites
     */
    public static XMLReader createXMLReader(boolean bl) throws SAXException {
        XMLReader xMLReader = null;
        if (!false) {
            xMLReader = SAXHelper.createXMLReaderViaJAXP(bl, true);
        }
        if (xMLReader == null) {
            XMLReader xMLReader2;
            xMLReader = xMLReader2 = XMLReaderFactory.createXMLReader();
        }
        if (xMLReader != null) return xMLReader;
        throw new SAXException("Couldn't create SAX reader");
        catch (Exception exception) {
            if (!SAXHelper.isVerboseErrorReporting()) throw new SAXException(exception);
            System.out.println("Warning: Caught exception attempting to use SAX to load a SAX XMLReader ");
            System.out.println(new StringBuffer().append("Warning: Exception was: ").append((Object)exception).toString());
            System.out.println("Warning: I will print the stack trace then carry on using the default SAX parser");
            exception.printStackTrace();
            throw new SAXException(exception);
        }
    }

    protected static XMLReader createXMLReaderViaJAXP(boolean bl, boolean bl2) {
        try {
            XMLReader xMLReader = JAXPHelper.createXMLReader(bl, bl2);
            return xMLReader;
        }
        catch (Throwable var2_3) {
            if (!loggedWarning) {
                loggedWarning = true;
                if (SAXHelper.isVerboseErrorReporting()) {
                    System.out.println("Warning: Caught exception attempting to use JAXP to load a SAX XMLReader");
                    System.out.println(new StringBuffer().append("Warning: Exception was: ").append((Object)var2_3).toString());
                    var2_3.printStackTrace();
                }
            }
            return null;
        }
    }

    /*
     * Enabled force condition propagation
     * Lifted jumps to return sites
     */
    protected static boolean isVerboseErrorReporting() {
        String string2;
        try {
            string2 = System.getProperty((String)"org.dom4j.verbose");
            if (string2 == null) return true;
        }
        catch (Exception var0_2) {
            return true;
        }
        boolean bl = string2.equalsIgnoreCase("true");
        if (!bl) return true;
        return true;
    }

    /*
     * Enabled force condition propagation
     * Lifted jumps to return sites
     */
    public static boolean setParserFeature(XMLReader xMLReader, String string2, boolean bl) {
        try {
            xMLReader.setFeature(string2, bl);
            return true;
        }
        catch (SAXNotSupportedException var4_3) {
            do {
                return false;
                break;
            } while (true);
        }
        catch (SAXNotRecognizedException var3_4) {
            return false;
        }
    }

    /*
     * Enabled force condition propagation
     * Lifted jumps to return sites
     */
    public static boolean setParserProperty(XMLReader xMLReader, String string2, Object object) {
        try {
            xMLReader.setProperty(string2, object);
            return true;
        }
        catch (SAXNotSupportedException var4_3) {
            do {
                return false;
                break;
            } while (true);
        }
        catch (SAXNotRecognizedException var3_4) {
            return false;
        }
    }
}

