工作空间 v3.6.5.2版本的 MD5 值为:58e65af156c65a63bf64ed2e64960853
以下内容为反编译后的 j.java 源代码,内容仅作参考
package c.a.c.a;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkCapabilities;
import android.net.NetworkInfo;
import android.os.Build;
import com.huawei.hms.framework.common.ContainerUtils;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.InetSocketAddress;
import java.net.MalformedURLException;
import java.net.Proxy;
import java.net.URL;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import javax.net.ssl.HttpsURLConnection;
import net.sqlcipher.database.SQLiteDatabase;
public class j {
private Context f1534a;
private String f1535b = null;
private HashMap<String, String> f1536c = null;
private String f1537d = null;
public j(Context context) {
this.f1534a = context;
}
private String a(Context context) {
try {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
if (connectivityManager == null) {
return null;
}
if (Build.VERSION.SDK_INT >= 29) {
NetworkCapabilities networkCapabilities = connectivityManager.getNetworkCapabilities(connectivityManager.getActiveNetwork());
if (networkCapabilities != null) {
return networkCapabilities.hasTransport(1) ? "WIFI" : networkCapabilities.hasTransport(0) ? "CELLULAR" : networkCapabilities.hasTransport(3) ? "ETHERNET" : networkCapabilities.hasTransport(6) ? "LoWPAN" : networkCapabilities.hasTransport(4) ? "VPN" : networkCapabilities.hasTransport(5) ? "WifiAware" : "wifi";
}
return "wifi";
}
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
if (activeNetworkInfo != null && activeNetworkInfo.isAvailable()) {
String extraInfo = activeNetworkInfo.getExtraInfo();
return (extraInfo == null || !(extraInfo.trim().toLowerCase().equals("cmwap") || extraInfo.trim().toLowerCase().equals("uniwap") || extraInfo.trim().toLowerCase().equals("3gwap") || extraInfo.trim().toLowerCase().equals("ctwap"))) ? "wifi" : extraInfo.trim().toLowerCase().equals("ctwap") ? "ctwap" : "cmwap";
}
return null;
} catch (Exception e2) {
if (d.f1524a) {
e2.printStackTrace();
}
return null;
}
}
private void a(HttpsURLConnection httpsURLConnection) {
int i;
OutputStream outputStream;
BufferedReader bufferedReader;
d.a("https Post start,url:" + this.f1535b);
if (this.f1536c == null) {
this.f1537d = a.a("httpsPost request paramters is null.");
return;
}
OutputStream outputStream2 = null;
BufferedReader bufferedReader2 = null;
r5 = null;
InputStream inputStream = null;
OutputStream outputStream3 = null;
OutputStream outputStream4 = null;
OutputStream outputStream5 = null;
boolean z = false;
try {
try {
outputStream = httpsURLConnection.getOutputStream();
} catch (Throwable th) {
th = th;
}
} catch (MalformedURLException e2) {
e = e2;
} catch (IOException e3) {
e = e3;
} catch (Exception e4) {
e = e4;
}
try {
try {
try {
BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(outputStream, "UTF-8"));
bufferedWriter.write(b(this.f1536c));
d.a(b(this.f1536c));
bufferedWriter.flush();
bufferedWriter.close();
httpsURLConnection.connect();
try {
InputStream inputStream2 = httpsURLConnection.getInputStream();
try {
i = httpsURLConnection.getResponseCode();
if (200 == i) {
try {
bufferedReader = new BufferedReader(new InputStreamReader(inputStream2, "UTF-8"));
try {
StringBuffer stringBuffer = new StringBuffer();
while (true) {
int read = bufferedReader.read();
if (read == -1) {
break;
}
stringBuffer.append((char) read);
}
this.f1537d = stringBuffer.toString();
bufferedReader2 = bufferedReader;
} catch (IOException e5) {
e = e5;
inputStream = inputStream2;
try {
if (d.f1524a) {
}
this.f1537d = a.a(-11, "httpsPost failed,IOException:" + e.getMessage());
if (inputStream != null) {
bufferedReader.close();
inputStream.close();
}
if (httpsURLConnection != null) {
}
if (outputStream != null) {
}
if (z) {
}
if (this.f1537d == null) {
}
} catch (Throwable th2) {
th = th2;
if (inputStream != null && bufferedReader != null) {
bufferedReader.close();
inputStream.close();
}
if (httpsURLConnection != null) {
httpsURLConnection.disconnect();
}
throw th;
}
} catch (Throwable th3) {
th = th3;
inputStream = inputStream2;
if (inputStream != null) {
}
if (httpsURLConnection != null) {
}
throw th;
}
} catch (IOException e6) {
e = e6;
bufferedReader = null;
} catch (Throwable th4) {
th = th4;
bufferedReader = null;
}
}
if (inputStream2 != null && bufferedReader2 != null) {
bufferedReader2.close();
inputStream2.close();
}
if (httpsURLConnection != null) {
httpsURLConnection.disconnect();
}
z = true;
} catch (IOException e7) {
e = e7;
bufferedReader = null;
inputStream = inputStream2;
i = -1;
if (d.f1524a) {
e.printStackTrace();
d.a("httpsPost parse failed;" + e.getMessage());
}
this.f1537d = a.a(-11, "httpsPost failed,IOException:" + e.getMessage());
if (inputStream != null && bufferedReader != null) {
bufferedReader.close();
inputStream.close();
}
if (httpsURLConnection != null) {
httpsURLConnection.disconnect();
}
if (outputStream != null) {
}
if (z) {
}
if (this.f1537d == null) {
}
} catch (Throwable th5) {
th = th5;
bufferedReader = null;
inputStream = inputStream2;
if (inputStream != null) {
bufferedReader.close();
inputStream.close();
}
if (httpsURLConnection != null) {
}
throw th;
}
} catch (IOException e8) {
e = e8;
bufferedReader = null;
} catch (Throwable th6) {
th = th6;
bufferedReader = null;
}
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e9) {
e = e9;
}
}
} catch (Throwable th7) {
th = th7;
outputStream3 = outputStream;
if (outputStream3 != null) {
try {
outputStream3.close();
} catch (IOException e10) {
if (d.f1524a) {
e10.printStackTrace();
}
}
}
throw th;
}
} catch (MalformedURLException e11) {
e = e11;
outputStream4 = outputStream;
if (d.f1524a) {
e.printStackTrace();
}
this.f1537d = a.a(-11, "httpsPost failed,MalformedURLException:" + e.getMessage());
if (outputStream4 != null) {
try {
outputStream4.close();
} catch (IOException e12) {
e = e12;
}
}
if (z) {
}
if (this.f1537d == null) {
}
} catch (IOException e13) {
e = e13;
outputStream5 = outputStream;
if (d.f1524a) {
e.printStackTrace();
}
this.f1537d = a.a(-11, "httpsPost failed,IOException:" + e.getMessage());
if (outputStream5 != null) {
try {
outputStream5.close();
} catch (IOException e14) {
e = e14;
}
}
if (z) {
}
if (this.f1537d == null) {
}
} catch (Exception e15) {
e = e15;
outputStream2 = outputStream;
if (d.f1524a) {
e.printStackTrace();
}
this.f1537d = a.a(-11, "httpsPost failed,Exception:" + e.getMessage());
if (outputStream2 != null) {
try {
outputStream2.close();
} catch (IOException e16) {
e = e16;
}
}
if (z) {
}
if (this.f1537d == null) {
}
}
} catch (MalformedURLException e17) {
e = e17;
outputStream4 = outputStream;
i = -1;
if (d.f1524a) {
}
this.f1537d = a.a(-11, "httpsPost failed,MalformedURLException:" + e.getMessage());
if (outputStream4 != null) {
}
if (z) {
}
if (this.f1537d == null) {
}
} catch (IOException e18) {
e = e18;
outputStream5 = outputStream;
i = -1;
if (d.f1524a) {
}
this.f1537d = a.a(-11, "httpsPost failed,IOException:" + e.getMessage());
if (outputStream5 != null) {
}
if (z) {
}
if (this.f1537d == null) {
}
} catch (Exception e19) {
e = e19;
outputStream2 = outputStream;
i = -1;
if (d.f1524a) {
}
this.f1537d = a.a(-11, "httpsPost failed,Exception:" + e.getMessage());
if (outputStream2 != null) {
}
if (z) {
}
if (this.f1537d == null) {
}
}
if (z || 200 == i) {
if (this.f1537d == null) {
d.a("httpsPost failed,mResult is null");
this.f1537d = a.a(-1, "httpsPost failed,internal error");
return;
}
d.a("httpsPost success end,parse result = " + this.f1537d);
return;
}
d.a("httpsPost failed,statusCode:" + i);
this.f1537d = a.a(-11, "httpsPost failed,statusCode:" + i);
}
private static String b(HashMap<String, String> hashMap) throws UnsupportedEncodingException {
StringBuilder sb = new StringBuilder();
boolean z = true;
for (Map.Entry<String, String> entry : hashMap.entrySet()) {
if (z) {
z = false;
} else {
sb.append(ContainerUtils.FIELD_DELIMITER);
}
sb.append(URLEncoder.encode(entry.getKey(), "UTF-8"));
sb.append(ContainerUtils.KEY_VALUE_DELIMITER);
sb.append(URLEncoder.encode(entry.getValue(), "UTF-8"));
}
return sb.toString();
}
private HttpsURLConnection b() {
String str;
try {
URL url = new URL(this.f1535b);
d.a("https URL: " + this.f1535b);
String a2 = a(this.f1534a);
if (a2 != null && !a2.equals("")) {
d.a("checkNetwork = " + a2);
HttpsURLConnection httpsURLConnection = (HttpsURLConnection) (a2.equals("cmwap") ? url.openConnection(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("10.0.0.172", 80))) : a2.equals("ctwap") ? url.openConnection(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("10.0.0.200", 80))) : url.openConnection());
httpsURLConnection.setHostnameVerifier(new k(this));
httpsURLConnection.setDoInput(true);
httpsURLConnection.setDoOutput(true);
httpsURLConnection.setRequestMethod("POST");
httpsURLConnection.setConnectTimeout(SQLiteDatabase.SQLITE_MAX_LIKE_PATTERN_LENGTH);
httpsURLConnection.setReadTimeout(SQLiteDatabase.SQLITE_MAX_LIKE_PATTERN_LENGTH);
return httpsURLConnection;
}
d.c("Current network is not available.");
this.f1537d = a.a(-10, "Current network is not available.");
return null;
} catch (MalformedURLException e2) {
if (d.f1524a) {
e2.printStackTrace();
d.a(e2.getMessage());
}
str = "Auth server could not be parsed as a URL.";
this.f1537d = a.a(-11, str);
return null;
} catch (Exception e3) {
if (d.f1524a) {
e3.printStackTrace();
d.a(e3.getMessage());
}
str = "Init httpsurlconnection failed.";
this.f1537d = a.a(-11, str);
return null;
}
}
private HashMap<String, String> c(HashMap<String, String> hashMap) {
HashMap<String, String> hashMap2 = new HashMap<>();
for (String str : hashMap.keySet()) {
String str2 = str.toString();
hashMap2.put(str2, hashMap.get(str2));
}
return hashMap2;
}
public String a(HashMap<String, String> hashMap) {
this.f1536c = c(hashMap);
this.f1535b = this.f1536c.get("url");
HttpsURLConnection b2 = b();
if (b2 == null) {
d.c("syncConnect failed,httpsURLConnection is null");
} else {
a(b2);
}
return this.f1537d;
}
public boolean a() {
d.a("checkNetwork start");
try {
ConnectivityManager connectivityManager = (ConnectivityManager) this.f1534a.getSystemService("connectivity");
if (connectivityManager == null) {
return false;
}
if (Build.VERSION.SDK_INT >= 29) {
NetworkCapabilities networkCapabilities = connectivityManager.getNetworkCapabilities(connectivityManager.getActiveNetwork());
return networkCapabilities != null && networkCapabilities.hasCapability(12) && networkCapabilities.hasCapability(16);
}
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
if (activeNetworkInfo == null || !activeNetworkInfo.isAvailable()) {
return false;
}
d.a("checkNetwork end");
return true;
} catch (Exception e2) {
if (d.f1524a) {
e2.printStackTrace();
}
return false;
}
}
}