package com.vivo.push.util; import android.content.Context; import android.os.Environment; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.Properties; /* access modifiers changed from: package-private */ /* compiled from: SdcardCache */ public final class v implements d { private static final String a = (Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + ".vivo/pushsdk/config"); private static final String b = (a + File.separator + "config.txt"); private static String c = "SdcardCache"; private File d; v() { } @Override // com.vivo.push.util.d public final boolean a(Context context) { if (!"mounted".equals(Environment.getExternalStorageState())) { return false; } File file = new File(a); boolean mkdirs = !file.exists() ? file.mkdirs() : true; if (mkdirs) { File file2 = new File(b); this.d = file2; if (!file2.exists()) { try { this.d.createNewFile(); return true; } catch (IOException e) { e.printStackTrace(); return false; } } } return mkdirs; } @Override // com.vivo.push.util.d public final String a(String str, String str2) { return a().getProperty(str, str2); } /* JADX WARNING: Removed duplicated region for block: B:17:0x0027 A[SYNTHETIC, Splitter:B:17:0x0027] */ /* JADX WARNING: Removed duplicated region for block: B:21:0x002e A[SYNTHETIC, Splitter:B:21:0x002e] */ /* JADX WARNING: Removed duplicated region for block: B:28:? A[RETURN, SYNTHETIC] */ @Override // com.vivo.push.util.d public final void b(String str, String str2) { Throwable th; Exception e; Properties a2 = a(); String str3 = b; FileOutputStream fileOutputStream = null; try { a2.setProperty(str, str2); FileOutputStream fileOutputStream2 = new FileOutputStream(str3); try { a2.store(fileOutputStream2, (String) null); fileOutputStream2.flush(); try { fileOutputStream2.close(); } catch (Exception unused) { } } catch (Exception e2) { e = e2; fileOutputStream = fileOutputStream2; try { e.printStackTrace(); if (fileOutputStream == null) { } } catch (Throwable th2) { th = th2; if (fileOutputStream != null) { } throw th; } } catch (Throwable th3) { th = th3; fileOutputStream = fileOutputStream2; if (fileOutputStream != null) { try { fileOutputStream.close(); } catch (Exception unused2) { } } throw th; } } catch (Exception e3) { e = e3; e.printStackTrace(); if (fileOutputStream == null) { try { fileOutputStream.close(); } catch (Exception unused3) { } } } } /* JADX WARNING: Code restructure failed: missing block: B:13:0x0024, code lost: if (r2 != null) goto L_0x0015; */ /* JADX WARNING: Removed duplicated region for block: B:19:0x002c A[SYNTHETIC, Splitter:B:19:0x002c] */ private static Properties a() { Throwable th; BufferedInputStream bufferedInputStream; Exception e; Properties properties = new Properties(); BufferedInputStream bufferedInputStream2 = null; try { bufferedInputStream = new BufferedInputStream(new FileInputStream(b)); try { properties.load(bufferedInputStream); } catch (Exception e2) { e = e2; try { e.printStackTrace(); } catch (Throwable th2) { th = th2; bufferedInputStream2 = bufferedInputStream; if (bufferedInputStream2 != null) { try { bufferedInputStream2.close(); } catch (IOException unused) { } } throw th; } } } catch (Exception e3) { bufferedInputStream = null; e = e3; e.printStackTrace(); } catch (Throwable th3) { th = th3; if (bufferedInputStream2 != null) { } throw th; } try { bufferedInputStream.close(); } catch (IOException unused2) { } return properties; } }