package com.tencent.mm.model.d;

public class b$3 implements Runnable {
    final /* synthetic */ b fpv;
    final /* synthetic */ String fpw;

    public b$3(b bVar, String str) {
        this.fpv = bVar;
        this.fpw = str;
    }

    /* JADX WARNING: Removed duplicated region for block: B:28:0x00eb A:{SYNTHETIC, Splitter:B:28:0x00eb} */
    /* JADX WARNING: Removed duplicated region for block: B:35:0x0100 A:{SYNTHETIC, Splitter:B:35:0x0100} */
    public final void run() {
        /*
        r12 = this;
        r11 = 16393; // 0x4009 float:2.2971E-41 double:8.099E-320;
        r10 = 0;
        com.tencent.matrix.trace.core.AppMethodBeat.i(r11);
        r3 = r12.fpv;
        r0 = new java.lang.StringBuilder;
        r0.<init>();
        r1 = com.tencent.mm.model.d.b.access$000();
        r0 = r0.append(r1);
        r1 = "MMSQL.trace";
        r0 = r0.append(r1);
        r0 = r0.toString();
        r1 = new java.lang.StringBuilder;
        r1.<init>();
        r2 = r12.fpw;
        r1 = r1.append(r2);
        r2 = "\n";
        r1 = r1.append(r2);
        r4 = r1.toString();
        r1 = com.tencent.mm.compatible.util.f.Mn();
        if (r1 != 0) goto L_0x0049;
    L_0x003c:
        r0 = "MicroMsg.SQLTraceManager";
        r1 = "sdcard is not  Available,appendToFile fail ";
        com.tencent.mm.sdk.platformtools.ab.i(r0, r1);
        com.tencent.matrix.trace.core.AppMethodBeat.o(r11);
    L_0x0048:
        return;
    L_0x0049:
        r1 = new java.io.File;	 Catch:{ Exception -> 0x00c3 }
        r2 = com.tencent.mm.model.d.b.fpk;	 Catch:{ Exception -> 0x00c3 }
        r1.<init>(r2);	 Catch:{ Exception -> 0x00c3 }
        r2 = r1.exists();	 Catch:{ Exception -> 0x00c3 }
        if (r2 != 0) goto L_0x0059;
    L_0x0056:
        r1.mkdirs();	 Catch:{ Exception -> 0x00c3 }
    L_0x0059:
        r1 = new java.io.File;	 Catch:{ Exception -> 0x00c3 }
        r2 = com.tencent.mm.model.d.b.fpk;	 Catch:{ Exception -> 0x00c3 }
        r5 = "MMSQL.trace";
        r1.<init>(r2, r5);	 Catch:{ Exception -> 0x00c3 }
        r2 = 0;
        r3.b(r1, r2);	 Catch:{ Exception -> 0x00c3 }
    L_0x0067:
        r1 = new java.io.File;
        r1.<init>(r0);
        r6 = r1.length();
        r8 = r3.fpp;
        r2 = (r6 > r8 ? 1 : (r6 == r8 ? 0 : -1));
        if (r2 <= 0) goto L_0x0083;
    L_0x0076:
        r2 = "MicroMsg.SQLTraceManager";
        r5 = "log file invaild foramt,recreate";
        com.tencent.mm.sdk.platformtools.ab.e(r2, r5);
        r2 = 1;
        r3.b(r1, r2);
    L_0x0083:
        r2 = 0;
        r1 = new java.io.RandomAccessFile;	 Catch:{ IOException -> 0x00db, all -> 0x00fc }
        r5 = "rw";
        r1.<init>(r0, r5);	 Catch:{ IOException -> 0x00db, all -> 0x00fc }
        r6 = r1.length();	 Catch:{ IOException -> 0x0116 }
        r1.seek(r6);	 Catch:{ IOException -> 0x0116 }
        r0 = r4.getBytes();	 Catch:{ IOException -> 0x0116 }
        r0 = com.tencent.mm.cf.e.ce(r0);	 Catch:{ IOException -> 0x0116 }
        r1.write(r0);	 Catch:{ IOException -> 0x0116 }
        r1.close();	 Catch:{ Exception -> 0x00ce }
    L_0x00a1:
        r0 = new java.io.File;
        r1 = new java.lang.StringBuilder;
        r1.<init>();
        r2 = com.tencent.mm.model.d.b.fpk;
        r1 = r1.append(r2);
        r2 = "MMSQL.trace";
        r1 = r1.append(r2);
        r1 = r1.toString();
        r0.<init>(r1);
        r3.z(r0);
        com.tencent.matrix.trace.core.AppMethodBeat.o(r11);
        goto L_0x0048;
    L_0x00c3:
        r1 = move-exception;
        r1 = "MicroMsg.SQLTraceManager";
        r2 = "init dir fail";
        com.tencent.mm.sdk.platformtools.ab.e(r1, r2);
        goto L_0x0067;
    L_0x00ce:
        r0 = move-exception;
        r1 = "MicroMsg.SQLTraceManager";
        r2 = "appendToFile fail with exception";
        r4 = new java.lang.Object[r10];
        com.tencent.mm.sdk.platformtools.ab.printErrStackTrace(r1, r0, r2, r4);
        goto L_0x00a1;
    L_0x00db:
        r0 = move-exception;
        r1 = r2;
    L_0x00dd:
        r2 = "MicroMsg.SQLTraceManager";
        r4 = "appendToFile fail with exception";
        r5 = 0;
        r5 = new java.lang.Object[r5];	 Catch:{ all -> 0x0114 }
        com.tencent.mm.sdk.platformtools.ab.printErrStackTrace(r2, r0, r4, r5);	 Catch:{ all -> 0x0114 }
        if (r1 == 0) goto L_0x00a1;
    L_0x00eb:
        r1.close();	 Catch:{ Exception -> 0x00ef }
        goto L_0x00a1;
    L_0x00ef:
        r0 = move-exception;
        r1 = "MicroMsg.SQLTraceManager";
        r2 = "appendToFile fail with exception";
        r4 = new java.lang.Object[r10];
        com.tencent.mm.sdk.platformtools.ab.printErrStackTrace(r1, r0, r2, r4);
        goto L_0x00a1;
    L_0x00fc:
        r0 = move-exception;
        r1 = r2;
    L_0x00fe:
        if (r1 == 0) goto L_0x0103;
    L_0x0100:
        r1.close();	 Catch:{ Exception -> 0x0107 }
    L_0x0103:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r11);
        throw r0;
    L_0x0107:
        r1 = move-exception;
        r2 = "MicroMsg.SQLTraceManager";
        r3 = "appendToFile fail with exception";
        r4 = new java.lang.Object[r10];
        com.tencent.mm.sdk.platformtools.ab.printErrStackTrace(r2, r1, r3, r4);
        goto L_0x0103;
    L_0x0114:
        r0 = move-exception;
        goto L_0x00fe;
    L_0x0116:
        r0 = move-exception;
        goto L_0x00dd;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.model.d.b$3.run():void");
    }
}
