package p138.p176.p291.p296.p297.p310;

import android.content.Context;
import android.util.Log;
import java.io.File;
import java.io.FileInputStream;
import org.json.JSONObject;
import p138.p176.p291.p296.p297.C5608;
import p138.p176.p291.p296.p297.p299.C5627;
import p138.p176.p291.p296.p297.p304.C5829;

/* JADX INFO: renamed from: ދ.ހ.ށ.ބ.ށ.ޏ.֏, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C5854 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final Context f16577;

    public C5854(Context context) {
        this.f16577 = context;
    }

    /* JADX WARN: Not initialized variable reg: 3, insn: 0x005b: MOVE (r1 I:??[OBJECT, ARRAY]) = (r3 I:??[OBJECT, ARRAY]), block:B:23:0x005a */
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public JSONObject m9200() throws Throwable {
        FileInputStream fileInputStream;
        FileInputStream fileInputStream2;
        JSONObject jSONObject;
        C5608.f16066.m8972("Reading cached settings...");
        FileInputStream fileInputStream3 = null;
        try {
            try {
                File file = new File(new C5829(this.f16577).m9146(), "com.crashlytics.settings.json");
                if (file.exists()) {
                    fileInputStream = new FileInputStream(file);
                    try {
                        jSONObject = new JSONObject(C5627.m8995(fileInputStream));
                        fileInputStream3 = fileInputStream;
                    } catch (Exception e) {
                        e = e;
                        C5608 c5608 = C5608.f16066;
                        if (c5608.m8974(6)) {
                            Log.e(c5608.f16067, "Failed to fetch cached settings", e);
                        }
                        C5627.m8998(fileInputStream, "Error while closing settings cache file.");
                        return null;
                    }
                } else {
                    C5608.f16066.m8972("No cached settings found.");
                    jSONObject = null;
                }
                C5627.m8998(fileInputStream3, "Error while closing settings cache file.");
                return jSONObject;
            } catch (Throwable th) {
                th = th;
                fileInputStream3 = fileInputStream2;
                C5627.m8998(fileInputStream3, "Error while closing settings cache file.");
                throw th;
            }
        } catch (Exception e2) {
            e = e2;
            fileInputStream = null;
        } catch (Throwable th2) {
            th = th2;
            C5627.m8998(fileInputStream3, "Error while closing settings cache file.");
            throw th;
        }
    }
}
