178 lines
6.7 KiB
Java
178 lines
6.7 KiB
Java
package com.tencent.bugly.proguard;
|
|
|
|
import android.content.Context;
|
|
import com.ijm.dataencryption.de.DataDecryptTool;
|
|
import com.tencent.bugly.BuglyStrategy;
|
|
import com.thoughtworks.xstream.XStream;
|
|
import java.io.BufferedInputStream;
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.OutputStream;
|
|
import java.net.HttpURLConnection;
|
|
import java.net.InetSocketAddress;
|
|
import java.net.Proxy;
|
|
import java.net.URL;
|
|
import java.net.URLEncoder;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Locale;
|
|
import java.util.Map;
|
|
|
|
/* compiled from: BUGLY */
|
|
/* loaded from: classes.dex */
|
|
public final class s {
|
|
private static s b;
|
|
public Map<String, String> a = null;
|
|
private Context c;
|
|
|
|
private s(Context context) {
|
|
this.c = context;
|
|
}
|
|
|
|
public static s a(Context context) {
|
|
if (b == null) {
|
|
b = new s(context);
|
|
}
|
|
return b;
|
|
}
|
|
|
|
private static byte[] b(HttpURLConnection httpURLConnection) {
|
|
BufferedInputStream bufferedInputStream;
|
|
if (httpURLConnection == null) {
|
|
return null;
|
|
}
|
|
try {
|
|
bufferedInputStream = new BufferedInputStream(httpURLConnection.getInputStream());
|
|
} catch (Throwable th) {
|
|
th = th;
|
|
bufferedInputStream = null;
|
|
}
|
|
try {
|
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
byte[] bArr = new byte[DataDecryptTool.DECRYPT_SP_FILE];
|
|
while (true) {
|
|
int read = bufferedInputStream.read(bArr);
|
|
if (read <= 0) {
|
|
break;
|
|
}
|
|
byteArrayOutputStream.write(bArr, 0, read);
|
|
}
|
|
byteArrayOutputStream.flush();
|
|
byte[] byteArray = byteArrayOutputStream.toByteArray();
|
|
try {
|
|
bufferedInputStream.close();
|
|
} catch (Throwable th2) {
|
|
th2.printStackTrace();
|
|
}
|
|
return byteArray;
|
|
} catch (Throwable th3) {
|
|
th = th3;
|
|
try {
|
|
if (!x.a(th)) {
|
|
th.printStackTrace();
|
|
}
|
|
return null;
|
|
} finally {
|
|
if (bufferedInputStream != null) {
|
|
try {
|
|
bufferedInputStream.close();
|
|
} catch (Throwable th4) {
|
|
th4.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:72:0x018a A[Catch: all -> 0x017d, TRY_LEAVE, TryCatch #9 {all -> 0x017d, blocks: (B:24:0x009b, B:26:0x00a3, B:29:0x00b4, B:39:0x00b2, B:85:0x00dd, B:104:0x00e5, B:91:0x0116, B:94:0x0120, B:52:0x013f, B:57:0x0162, B:70:0x0184, B:72:0x018a), top: B:23:0x009b }] */
|
|
/* JADX WARN: Unreachable blocks removed: 2, instructions: 2 */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
|
*/
|
|
public final byte[] a(java.lang.String r23, byte[] r24, com.tencent.bugly.proguard.v r25, java.util.Map<java.lang.String, java.lang.String> r26) {
|
|
/*
|
|
Method dump skipped, instructions count: 456
|
|
To view this dump change 'Code comments level' option to 'DEBUG'
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.proguard.s.a(java.lang.String, byte[], com.tencent.bugly.proguard.v, java.util.Map):byte[]");
|
|
}
|
|
|
|
private static Map<String, String> a(HttpURLConnection httpURLConnection) {
|
|
HashMap hashMap = new HashMap();
|
|
Map<String, List<String>> headerFields = httpURLConnection.getHeaderFields();
|
|
if (headerFields == null || headerFields.size() == 0) {
|
|
return null;
|
|
}
|
|
for (String str : headerFields.keySet()) {
|
|
List<String> list = headerFields.get(str);
|
|
if (list.size() > 0) {
|
|
hashMap.put(str, list.get(0));
|
|
}
|
|
}
|
|
return hashMap;
|
|
}
|
|
|
|
private HttpURLConnection a(String str, byte[] bArr, String str2, Map<String, String> map) {
|
|
if (str == null) {
|
|
x.e("destUrl is null.", new Object[0]);
|
|
return null;
|
|
}
|
|
HttpURLConnection a = a(str2, str);
|
|
if (a == null) {
|
|
x.e("Failed to get HttpURLConnection object.", new Object[0]);
|
|
return null;
|
|
}
|
|
try {
|
|
a.setRequestProperty("wup_version", "3.0");
|
|
if (map != null && map.size() > 0) {
|
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
|
a.setRequestProperty(entry.getKey(), URLEncoder.encode(entry.getValue(), "utf-8"));
|
|
}
|
|
}
|
|
a.setRequestProperty("A37", URLEncoder.encode(str2, "utf-8"));
|
|
a.setRequestProperty("A38", URLEncoder.encode(str2, "utf-8"));
|
|
OutputStream outputStream = a.getOutputStream();
|
|
if (bArr == null) {
|
|
outputStream.write(0);
|
|
} else {
|
|
outputStream.write(bArr);
|
|
}
|
|
return a;
|
|
} catch (Throwable th) {
|
|
if (!x.a(th)) {
|
|
th.printStackTrace();
|
|
}
|
|
x.e("Failed to upload, please check your network.", new Object[0]);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private static HttpURLConnection a(String str, String str2) {
|
|
HttpURLConnection httpURLConnection;
|
|
try {
|
|
URL url = new URL(str2);
|
|
if (a.b() != null) {
|
|
httpURLConnection = (HttpURLConnection) url.openConnection(a.b());
|
|
} else if (str != null && str.toLowerCase(Locale.US).contains("wap")) {
|
|
httpURLConnection = (HttpURLConnection) url.openConnection(new Proxy(Proxy.Type.HTTP, new InetSocketAddress(System.getProperty("http.proxyHost"), Integer.parseInt(System.getProperty("http.proxyPort")))));
|
|
} else {
|
|
httpURLConnection = (HttpURLConnection) url.openConnection();
|
|
}
|
|
httpURLConnection.setConnectTimeout(BuglyStrategy.a.MAX_USERDATA_VALUE_LENGTH);
|
|
httpURLConnection.setReadTimeout(XStream.PRIORITY_VERY_HIGH);
|
|
httpURLConnection.setDoOutput(true);
|
|
httpURLConnection.setDoInput(true);
|
|
httpURLConnection.setRequestMethod("POST");
|
|
httpURLConnection.setUseCaches(false);
|
|
httpURLConnection.setInstanceFollowRedirects(false);
|
|
return httpURLConnection;
|
|
} catch (Throwable th) {
|
|
if (x.a(th)) {
|
|
return null;
|
|
}
|
|
th.printStackTrace();
|
|
return null;
|
|
}
|
|
}
|
|
}
|