萝莉来了 v1.2.1版本的 MD5 值为:6055c21e001561c5b114d0da5b392fcb
以下内容为反编译后的 ay.java 源代码,内容仅作参考
package com.lthj.unipay.plugin;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Message;
import android.util.Log;
import cn.cmgame.billing.util.Const;
import com.flurry.org.codehaus.jackson.util.MinimalPrettyPrinter;
import com.unionpay.upomp.lthj.plugin.ui.JniMethod;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URL;
public class ay implements Runnable {
final de a;
private OutputStream b;
private InputStream c;
private HttpURLConnection d;
private Proxy e;
public ay(de deVar) {
this.a = deVar;
}
private void a(String str) {
if (str.length() == 0) {
throw new Exception("服务器返回的数据错误");
}
byte[] chackPanDecrypt = JniMethod.getJniMethod().chackPanDecrypt(str.getBytes(), str.length());
if (chackPanDecrypt == null) {
throw new Exception("数据异常,jni解密错误");
}
String str2 = new String(chackPanDecrypt);
String[] split = str2.split("\\|");
aw.a("binnet", str2);
if (Const.dD.equals(split[0])) {
this.a.a.sendEmptyMessage(1);
} else {
b("(" + split[0] + ")" + split[1]);
}
}
private void a(byte[] bArr, int i, int i2) {
this.b.write(bArr, i, i2);
this.b.flush();
Log.d("---plugin-send data length=", MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR + bArr.length);
}
private void b(String str) {
Message obtain = Message.obtain();
obtain.obj = str;
obtain.what = 0;
this.a.a.sendMessage(obtain);
}
private void c() {
Context context;
context = this.a.j;
NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo();
if (activeNetworkInfo != null && activeNetworkInfo.isAvailable() && activeNetworkInfo.getType() == 0) {
String defaultHost = android.net.Proxy.getDefaultHost();
int defaultPort = android.net.Proxy.getDefaultPort();
if (defaultHost != null) {
this.e = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(defaultHost, defaultPort));
}
}
}
public void a() {
String str;
String str2;
URL url = new URL(as.a().e ? "http://211.154.166.219/busplat/order/checkPan.action" : "http://auth.uupay.net/busplat/order/checkPan.action");
if (this.e != null) {
this.d = (HttpURLConnection) url.openConnection(this.e);
} else {
this.d = (HttpURLConnection) url.openConnection();
}
this.d.setRequestMethod("POST");
this.d.setUseCaches(false);
this.d.setRequestProperty("Charset", "UTF-8");
this.d.setRequestProperty(cn.cmgame.sdk.e.b.fZ, "text/plain");
this.d.setDoInput(true);
this.d.setDoOutput(true);
this.d.setConnectTimeout(120000);
this.d.setReadTimeout(120000);
if (at.a != null) {
this.d.setRequestProperty("sessionId", at.a);
Log.d("---HttpNet-connect-sessionId-=", at.a);
} else {
Log.d("---HttpNet-connect-sessionId-is null=", "sessionId is null");
}
this.b = new DataOutputStream(this.d.getOutputStream());
JniMethod jniMethod = JniMethod.getJniMethod();
str = this.a.k;
byte[] bytes = str.getBytes();
str2 = this.a.k;
byte[] chackPanEncrypt = jniMethod.chackPanEncrypt(bytes, str2.length());
a(chackPanEncrypt, 0, chackPanEncrypt.length);
this.d.connect();
int responseCode = this.d.getResponseCode();
if (this.d.getResponseCode() != 200) {
throw new Exception(responseCode == 504 ? "网络连接超时, 请检查您的网络设置, 或稍候重试!" : "网络连接失败, 请检查您的网络设置, 或稍候重试!\r\n错误号: " + Integer.toString(responseCode));
}
}
public void b() {
try {
if (this.c != null) {
this.c.close();
this.c = null;
}
if (this.b != null) {
this.b.close();
this.b = null;
}
if (this.d != null) {
this.d.disconnect();
this.d = null;
}
} catch (Exception e) {
try {
this.d = null;
this.b = null;
this.c = null;
} catch (Exception e2) {
Log.d("---HttpNet-disconnect-e=", e2.getMessage());
}
}
}
@Override
public void run() {
BufferedReader bufferedReader;
InputStreamReader inputStreamReader;
InputStreamReader inputStreamReader2 = null;
c();
try {
a();
} catch (Exception e) {
e.printStackTrace();
this.a.a("网络连接失败,请检查网络");
}
try {
if (this.d.getResponseCode() == 200) {
this.c = this.d.getInputStream();
inputStreamReader = new InputStreamReader(this.c);
try {
bufferedReader = new BufferedReader(inputStreamReader, 8192);
} catch (Exception e2) {
e = e2;
bufferedReader = null;
inputStreamReader2 = inputStreamReader;
} catch (Throwable th) {
th = th;
bufferedReader = null;
inputStreamReader2 = inputStreamReader;
}
try {
StringBuilder sb = new StringBuilder();
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
} else {
sb.append(readLine);
}
}
aw.a("net data", sb.toString());
a(sb.toString());
} catch (Exception e3) {
e = e3;
inputStreamReader2 = inputStreamReader;
try {
this.a.a("网络异常");
e.printStackTrace();
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (IOException e4) {
e4.printStackTrace();
b();
return;
}
}
if (inputStreamReader2 != null) {
inputStreamReader2.close();
}
b();
return;
} catch (Throwable th2) {
th = th2;
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (IOException e5) {
e5.printStackTrace();
b();
throw th;
}
}
if (inputStreamReader2 != null) {
inputStreamReader2.close();
}
b();
throw th;
}
} catch (Throwable th3) {
th = th3;
inputStreamReader2 = inputStreamReader;
if (bufferedReader != null) {
}
if (inputStreamReader2 != null) {
}
b();
throw th;
}
} else {
this.a.a("网络异常");
bufferedReader = null;
inputStreamReader = null;
}
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (IOException e6) {
e6.printStackTrace();
}
}
if (inputStreamReader != null) {
inputStreamReader.close();
}
b();
} catch (Exception e7) {
e = e7;
bufferedReader = null;
} catch (Throwable th4) {
th = th4;
bufferedReader = null;
}
}
}