discord-jadx/app/src/main/java/c/i/a/f/i/b/c4.java

195 lines
7.5 KiB
Java

package c.i.a.f.i.b;
import androidx.annotation.WorkerThread;
import com.airbnb.lottie.parser.AnimatableValueParser;
import java.io.IOException;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;
import java.util.Map;
/* compiled from: com.google.android.gms:play-services-measurement@@18.0.0 */
@WorkerThread
public final class c4 implements Runnable {
public final URL i;
public final byte[] j;
public final z3 k;
public final String l;
public final Map<String, String> m;
public final /* synthetic */ x3 n;
public c4(x3 x3Var, String str, URL url, byte[] bArr, Map<String, String> map, z3 z3Var) {
this.n = x3Var;
AnimatableValueParser.w(str);
this.i = url;
this.j = bArr;
this.k = z3Var;
this.l = str;
this.m = map;
}
/* JADX WARNING: Removed duplicated region for block: B:44:0x00c9 A[SYNTHETIC, Splitter:B:44:0x00c9] */
/* JADX WARNING: Removed duplicated region for block: B:49:0x00e1 */
/* JADX WARNING: Removed duplicated region for block: B:57:0x0102 A[SYNTHETIC, Splitter:B:57:0x0102] */
/* JADX WARNING: Removed duplicated region for block: B:62:0x011a */
@Override // java.lang.Runnable
public final void run() {
Map<String, List<String>> map;
IOException iOException;
int i;
HttpURLConnection httpURLConnection;
IOException e;
Map<String, List<String>> map2;
int i2;
Throwable th;
Throwable th2;
IOException e2;
this.n.a();
OutputStream outputStream = null;
try {
httpURLConnection = this.n.s(this.i);
try {
Map<String, String> map3 = this.m;
if (map3 != null) {
for (Map.Entry<String, String> entry : map3.entrySet()) {
httpURLConnection.addRequestProperty(entry.getKey(), entry.getValue());
}
}
if (this.j != null) {
byte[] T = this.n.m().T(this.j);
this.n.g().n.b("Uploading data. size", Integer.valueOf(T.length));
httpURLConnection.setDoOutput(true);
httpURLConnection.addRequestProperty("Content-Encoding", "gzip");
httpURLConnection.setFixedLengthStreamingMode(T.length);
httpURLConnection.connect();
OutputStream outputStream2 = httpURLConnection.getOutputStream();
try {
outputStream2.write(T);
outputStream2.close();
} catch (IOException e3) {
map = null;
iOException = e3;
outputStream = outputStream2;
} catch (Throwable th3) {
map2 = null;
th = th3;
outputStream = outputStream2;
i2 = 0;
if (outputStream != null) {
}
if (httpURLConnection != null) {
}
this.n.f().v(new y3(this.l, this.k, i2, null, null, map2, null));
throw th;
}
}
int responseCode = httpURLConnection.getResponseCode();
try {
Map<String, List<String>> headerFields = httpURLConnection.getHeaderFields();
try {
byte[] t = x3.t(httpURLConnection);
httpURLConnection.disconnect();
this.n.f().v(new y3(this.l, this.k, responseCode, null, t, headerFields, null));
} catch (IOException e4) {
e2 = e4;
i = responseCode;
map = headerFields;
iOException = e2;
if (outputStream != null) {
}
if (httpURLConnection != null) {
}
this.n.f().v(new y3(this.l, this.k, i, iOException, null, map, null));
} catch (Throwable th4) {
th = th4;
i2 = responseCode;
map2 = headerFields;
if (outputStream != null) {
}
if (httpURLConnection != null) {
}
this.n.f().v(new y3(this.l, this.k, i2, null, null, map2, null));
throw th;
}
} catch (IOException e5) {
e2 = e5;
map = null;
i = responseCode;
iOException = e2;
if (outputStream != null) {
}
if (httpURLConnection != null) {
}
this.n.f().v(new y3(this.l, this.k, i, iOException, null, map, null));
} catch (Throwable th5) {
map2 = null;
th = th5;
i2 = responseCode;
if (outputStream != null) {
}
if (httpURLConnection != null) {
}
this.n.f().v(new y3(this.l, this.k, i2, null, null, map2, null));
throw th;
}
} catch (IOException e6) {
e = e6;
map = null;
iOException = e;
i = 0;
if (outputStream != null) {
}
if (httpURLConnection != null) {
}
this.n.f().v(new y3(this.l, this.k, i, iOException, null, map, null));
} catch (Throwable th6) {
th2 = th6;
map2 = null;
th = th2;
i2 = 0;
if (outputStream != null) {
}
if (httpURLConnection != null) {
}
this.n.f().v(new y3(this.l, this.k, i2, null, null, map2, null));
throw th;
}
} catch (IOException e7) {
e = e7;
httpURLConnection = null;
map = null;
iOException = e;
i = 0;
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e8) {
this.n.g().f.c("Error closing HTTP compressed POST connection output stream. appId", q3.s(this.l), e8);
}
}
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
this.n.f().v(new y3(this.l, this.k, i, iOException, null, map, null));
} catch (Throwable th7) {
th2 = th7;
httpURLConnection = null;
map2 = null;
th = th2;
i2 = 0;
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e9) {
this.n.g().f.c("Error closing HTTP compressed POST connection output stream. appId", q3.s(this.l), e9);
}
}
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
this.n.f().v(new y3(this.l, this.k, i2, null, null, map2, null));
throw th;
}
}
}