package e.w.h.c; import android.annotation.TargetApi; import android.content.Context; import android.text.TextUtils; 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 w { /* renamed from: g reason: collision with root package name */ public static w f12758g; /* renamed from: a reason: collision with root package name */ public Context f12759a = null; public File b = null; public String c = "https://log.tbs.qq.com/ajax?c=pu&v=2&k="; public String d = "https://log.tbs.qq.com/ajax?c=pu&tk="; /* renamed from: e reason: collision with root package name */ public String f12760e = "https://log.tbs.qq.com/ajax?c=dl&k="; /* renamed from: f reason: collision with root package name */ public String f12761f = "https://cfg.imtt.qq.com/tbs?v=2&mk="; /* JADX WARNING: Code restructure failed: missing block: B:29:0x00ef, code lost: if (r7 != null) goto L_0x00b9; */ @TargetApi(11) public w(Context context) { BufferedInputStream bufferedInputStream; Throwable th; e.i("TbsCommonConfig", "", "TbsCommonConfig constructing..."); this.f12759a = context.getApplicationContext(); synchronized (this) { try { File c2 = c(); if (c2 == null) { e.b("TbsCommonConfig", "", "Config file is null, default values will be applied"); } else { bufferedInputStream = new BufferedInputStream(new FileInputStream(c2)); try { Properties properties = new Properties(); properties.load(bufferedInputStream); String property = properties.getProperty("pv_post_url", ""); if (!"".equals(property)) { this.c = property; } String property2 = properties.getProperty("tbs_download_stat_post_url", ""); if (!"".equals(property2)) { this.f12760e = property2; } String property3 = properties.getProperty("tbs_downloader_post_url", ""); e.e("TbsCommonConfig", "", "KEY_TBS_DOWNLOADER_POST_URL is " + property3); if (!"".equals(property3)) { this.f12761f = property3; } "".equals(properties.getProperty("tbs_log_post_url", "")); String property4 = properties.getProperty("pv_post_url_tk", ""); if (!"".equals(property4)) { this.d = property4; } } catch (Throwable th2) { th = th2; try { StringWriter stringWriter = new StringWriter(); th.printStackTrace(new PrintWriter(stringWriter)); e.b("TbsCommonConfig", "", "exceptions occurred1:" + stringWriter.toString()); } catch (Throwable th3) { if (bufferedInputStream != null) { try { bufferedInputStream.close(); } catch (IOException e2) { e2.printStackTrace(); } } throw th3; } } try { bufferedInputStream.close(); } catch (IOException e3) { e3.printStackTrace(); } } } catch (Throwable th4) { th = th4; bufferedInputStream = null; StringWriter stringWriter2 = new StringWriter(); th.printStackTrace(new PrintWriter(stringWriter2)); e.b("TbsCommonConfig", "", "exceptions occurred1:" + stringWriter2.toString()); } } return; } public static synchronized w a() { w wVar; synchronized (w.class) { wVar = f12758g; } return wVar; } public static synchronized w b(Context context) { w wVar; synchronized (w.class) { if (f12758g == null) { f12758g = new w(context); } wVar = f12758g; } return wVar; } public final File c() { Throwable th; File file = null; try { if (this.b == null) { if (!TextUtils.isEmpty(this.f12759a.getApplicationContext().getApplicationInfo().packageName)) { this.b = new File(b.b(this.f12759a, 8)); } File file2 = this.b; if (file2 == null || !file2.isDirectory()) { return null; } } e.e("TbsCommonConfig", "", "mTbsConfigDir is " + this.b.getAbsolutePath()); File file3 = new File(this.b, "tbsnet.conf"); if (!file3.exists()) { e.b("TbsCommonConfig", "", "Get file(" + file3.getCanonicalPath() + ") failed!"); return null; } try { e.i("TbsCommonConfig", "", "pathc:" + file3.getCanonicalPath()); return file3; } catch (Throwable th2) { th = th2; file = file3; } } catch (Throwable th3) { th = th3; StringWriter stringWriter = new StringWriter(); th.printStackTrace(new PrintWriter(stringWriter)); e.b("TbsCommonConfig", "", "exceptions occurred2:" + stringWriter.toString()); return file; } } }