翰林优商.apk(点击下载) / n.java


package com.tencent.smtt.utils;

import android.content.Context;
import android.text.TextUtils;
import com.kuaishou.weapon.p0.h;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Properties;

public class n {
    private static n c;
    private Context a = null;
    private File b = null;
    private String d = "https://log.tbs.qq.com/ajax?c=pu&v=2&k=";
    private String e = "https://log.tbs.qq.com/ajax?c=pu&tk=";
    private String f = "https://log.tbs.qq.com/ajax?c=dl&k=";
    private String g = "https://cfg.imtt.qq.com/tbs?v=2&mk=";
    private String h = "https://log.tbs.qq.com/ajax?c=ul&v=2&k=";
    private String i = "https://mqqad.html5.qq.com/adjs";
    private String j = "https://log.tbs.qq.com/ajax?c=ucfu&k=";
    private String k = "";
    private String l = "";
    private String m = "";
    private String n = "https://tbsrecovery.imtt.qq.com/getconfig";

    private n(Context context) {
        TbsLog.w("TbsCommonConfig", "TbsCommonConfig constructing...");
        this.a = context.getApplicationContext();
        k();
    }

    public static synchronized n a() {
        n nVar;
        synchronized (n.class) {
            nVar = c;
        }
        return nVar;
    }

    public static synchronized n a(Context context) {
        n nVar;
        synchronized (n.class) {
            if (c == null) {
                c = new n(context);
            }
            nVar = c;
        }
        return nVar;
    }

    /* JADX WARNING: Removed duplicated region for block: B:54:0x0179 A[SYNTHETIC, Splitter:B:54:0x0179] */
    private synchronized void k() {
        Throwable th;
        BufferedInputStream bufferedInputStream = null;
        try {
            File l2 = l();
            if (l2 == null) {
                TbsLog.e("TbsCommonConfig", "Config file is null, default values will be applied");
                return;
            }
            BufferedInputStream bufferedInputStream2 = new BufferedInputStream(new FileInputStream(l2));
            try {
                Properties properties = new Properties();
                properties.load(bufferedInputStream2);
                String property = properties.getProperty("pv_post_url", "");
                if (!"".equals(property)) {
                    this.d = property;
                }
                String property2 = properties.getProperty("tbs_download_stat_post_url", "");
                if (!"".equals(property2)) {
                    this.f = property2;
                }
                String property3 = properties.getProperty("tbs_downloader_post_url", "");
                TbsLog.i("TbsCommonConfig", "KEY_TBS_DOWNLOADER_POST_URL is " + property3);
                if (!"".equals(property3)) {
                    this.g = property3;
                }
                String property4 = properties.getProperty("tbs_downloader_response_query", "");
                TbsLog.i("TbsCommonConfig", "KEY_TBS_DOWNLOADER_RESPONSE_QUERY is " + property4);
                if (!"".equals(property4)) {
                    this.k = property4;
                }
                String property5 = properties.getProperty("tbs_downloader_response_update", "");
                TbsLog.i("TbsCommonConfig", "KEY_TBS_DOWNLOADER_RESPONSE_UPDATE is " + property5);
                if (!"".equals(property5)) {
                    this.l = property5;
                }
                String property6 = properties.getProperty("tbs_downloader_response_download", "");
                TbsLog.i("TbsCommonConfig", "KEY_TBS_DOWNLOADER_RESPONSE_DOWNLOAD is " + property6);
                if (!"".equals(property6)) {
                    this.m = property6;
                }
                String property7 = properties.getProperty("tbs_log_post_url", "");
                if (!"".equals(property7)) {
                    this.h = property7;
                }
                String property8 = properties.getProperty("tips_url", "");
                if (!"".equals(property8)) {
                    this.i = property8;
                }
                String property9 = properties.getProperty("tbs_cmd_post_url", "");
                if (!"".equals(property9)) {
                    this.j = property9;
                }
                String property10 = properties.getProperty("tbs_emergency_post_url", "");
                if (!"".equals(property10)) {
                    this.n = property10;
                }
                String property11 = properties.getProperty("pv_post_url_tk", "");
                if (!"".equals(property11)) {
                    this.e = property11;
                }
                try {
                    bufferedInputStream2.close();
                } catch (IOException e2) {
                    e = e2;
                }
            } catch (Throwable th2) {
                th = th2;
                bufferedInputStream = bufferedInputStream2;
                try {
                    StringWriter stringWriter = new StringWriter();
                    th.printStackTrace(new PrintWriter(stringWriter));
                    TbsLog.e("TbsCommonConfig", "exceptions occurred1:" + stringWriter.toString());
                    if (bufferedInputStream != null) {
                        try {
                            bufferedInputStream.close();
                        } catch (IOException e3) {
                            e = e3;
                        }
                    }
                } catch (Throwable th3) {
                    if (bufferedInputStream != null) {
                        try {
                            bufferedInputStream.close();
                        } catch (IOException e4) {
                            e4.printStackTrace();
                        }
                    }
                    throw th3;
                }
            }
        } catch (Throwable th4) {
            th = th4;
            StringWriter stringWriter2 = new StringWriter();
            th.printStackTrace(new PrintWriter(stringWriter2));
            TbsLog.e("TbsCommonConfig", "exceptions occurred1:" + stringWriter2.toString());
            if (bufferedInputStream != null) {
            }
        }
        e.printStackTrace();
    }

    private File l() {
        Throwable th;
        File file;
        File file2 = null;
        try {
            if (this.b == null) {
                String str = this.a.getApplicationContext().getApplicationInfo().packageName;
                if (!TextUtils.isEmpty(str)) {
                    boolean z = true;
                    boolean z2 = this.a.getPackageManager().checkPermission(h.i, str) == 0;
                    if (this.a.getPackageManager().checkPermission(h.j, str) != 0) {
                        z = false;
                    }
                    if (!z2) {
                        if (!z) {
                            file = new File(FileUtil.a(this.a, 8));
                        }
                    }
                    TbsLog.i("TbsCommonConfig", "no permission,use sdcard default folder");
                    file = new File(FileUtil.a(this.a, 5));
                } else {
                    file = new File(FileUtil.a(this.a, 8));
                }
                this.b = file;
                File file3 = this.b;
                if (file3 == null || !file3.isDirectory()) {
                    return null;
                }
            }
            TbsLog.i("TbsCommonConfig", "mTbsConfigDir is " + this.b.getAbsolutePath());
            File file4 = new File(this.b, "tbsnet.conf");
            if (!file4.exists()) {
                TbsLog.e("TbsCommonConfig", "Get file(" + file4.getCanonicalPath() + ") failed!");
                return null;
            }
            try {
                TbsLog.w("TbsCommonConfig", "pathc:" + file4.getCanonicalPath());
                return file4;
            } catch (Throwable th2) {
                th = th2;
                file2 = file4;
            }
        } catch (Throwable th3) {
            th = th3;
            StringWriter stringWriter = new StringWriter();
            th.printStackTrace(new PrintWriter(stringWriter));
            TbsLog.e("TbsCommonConfig", "exceptions occurred2:" + stringWriter.toString());
            return file2;
        }
    }

    public String b() {
        return this.d;
    }

    public String c() {
        return this.f;
    }

    public String d() {
        return this.k;
    }

    public String e() {
        return this.l;
    }

    public String f() {
        return this.m;
    }

    public String g() {
        return this.g;
    }

    public String h() {
        return this.h;
    }

    public String i() {
        return this.e;
    }

    public String j() {
        return this.n;
    }
}