中建乐购 v3.2.3版本的 MD5 值为:3856d0da11f056931d64951d23a4b3b8
以下内容为反编译后的 b.java 源代码,内容仅作参考
package fy;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import fz.e;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONException;
import org.json.JSONObject;
public class b {
private static final String f18772a = "fy.b";
private static b f18773b;
private Context f18774c;
private Object f18775d = new Object();
class a extends Thread {
HttpPost f18776a;
String f18777b;
gs.a f18778c;
String f18779d;
String f18780e;
String f18781f;
public a(HttpPost httpPost) {
this.f18777b = "";
this.f18781f = "";
this.f18776a = httpPost;
}
public a(HttpPost httpPost, gs.a aVar, String str, String str2, String str3) {
this.f18777b = "";
this.f18781f = "";
this.f18776a = httpPost;
this.f18778c = aVar;
this.f18779d = str;
this.f18780e = str2;
this.f18781f = str3;
}
@Override
public final void run() {
HttpResponse httpResponse;
if (this.f18778c != null) {
this.f18778c.a(1000, this.f18779d);
}
BufferedReader bufferedReader = null;
try {
httpResponse = new DefaultHttpClient().execute(this.f18776a);
} catch (Exception e2) {
if (this.f18778c != null) {
this.f18778c.a(1002, this.f18779d);
}
Log.e(b.f18772a, e2.toString());
httpResponse = null;
}
try {
if (httpResponse == null) {
Log.e(b.f18772a, "response is null!");
} else {
bufferedReader = new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent(), Charset.forName("UTF-8")));
}
} catch (Exception e3) {
if (this.f18778c != null) {
this.f18778c.a(1002, this.f18779d);
}
Log.e(b.f18772a, e3.toString());
}
try {
if (bufferedReader != null) {
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
if (fz.c.f18804a) {
Log.d(b.f18772a, readLine);
}
this.f18777b = readLine;
}
} else {
Log.e(b.f18772a, "BufferredReader is null!");
}
} catch (Exception e4) {
if (this.f18778c != null) {
this.f18778c.a(1002, this.f18779d);
}
Log.e(b.f18772a, e4.toString());
}
if (bufferedReader != null) {
try {
bufferedReader.close();
if (fz.c.f18804a) {
Log.d(b.f18772a, "close the bufferreader");
}
} catch (IOException e5) {
Log.e(b.f18772a, e5.toString());
}
}
if (this.f18778c == null) {
synchronized (b.this.f18775d) {
b.this.f18775d.notifyAll();
}
return;
}
String b2 = b.b(this.f18777b, this.f18779d);
this.f18778c.a(1001, b2);
c.a(b.this.f18774c, this.f18780e, b2, this.f18781f);
}
public final String a() {
return this.f18777b;
}
}
public static synchronized b a(Context context) {
b bVar;
synchronized (b.class) {
if (f18773b == null) {
f18773b = new b(context);
}
bVar = f18773b;
}
return bVar;
}
private b(Context context) {
this.f18774c = context;
}
public final void a(String str, String str2, String str3, String str4, gs.a aVar) {
String b2 = b(str, str2, str3, str4);
if (fz.c.f18804a) {
String str5 = f18772a;
Log.d(str5, "url:" + b2 + "; len:" + b2.length());
}
new a(new HttpPost(b2), aVar, str4, str, str2).start();
}
public final String a(String str, String str2, String str3, String str4) {
String b2 = b(str, str2, str3, str4);
int i2 = e.b(this.f18774c) ? dg.b.f14355c : 1000;
if (fz.c.f18804a) {
String str5 = f18772a;
Log.d(str5, "url:" + b2 + "; timeout:" + i2);
}
a aVar = new a(new HttpPost(b2));
aVar.start();
try {
synchronized (this.f18775d) {
this.f18775d.wait(i2);
}
} catch (Exception e2) {
Log.e(f18772a, e2.toString());
}
String a2 = aVar.a();
if (fz.c.f18804a) {
String str6 = f18772a;
Log.d(str6, "mLine:" + a2);
}
return b(a2, str4);
}
public static String b(String str, String str2) {
String str3;
if (TextUtils.isEmpty(str)) {
return str2;
}
try {
JSONObject jSONObject = new JSONObject(str);
if (jSONObject.has("data")) {
JSONObject jSONObject2 = jSONObject.getJSONObject("data");
if (!jSONObject2.has("action") || !jSONObject2.has("aid")) {
return str2;
}
String string = jSONObject2.getString("action");
if (!string.equalsIgnoreCase("new") && !string.equalsIgnoreCase("changed")) {
return str2;
}
str3 = jSONObject2.getString("aid");
} else if (!jSONObject.has("isError") || !jSONObject.has("status")) {
return str2;
} else {
String string2 = jSONObject.getString("isError");
String string3 = jSONObject.getString("status");
if (!string2.equalsIgnoreCase("true")) {
return str2;
}
if (!string3.equalsIgnoreCase(fu.b.f18531b) && !string3.equalsIgnoreCase("401")) {
return str2;
}
if (fz.c.f18804a) {
String str4 = f18772a;
Log.d(str4, "remove the AID, status:" + string3);
}
str3 = "";
}
return str3;
} catch (JSONException e2) {
Log.e(f18772a, e2.toString());
return str2;
} catch (Exception e3) {
Log.e(f18772a, e3.toString());
return str2;
}
}
private static String b(String str, String str2, String str3, String str4) {
StringBuilder sb = new StringBuilder();
try {
str3 = URLEncoder.encode(str3, "UTF-8");
} catch (UnsupportedEncodingException e2) {
e2.printStackTrace();
}
sb.append("http://hydra.alibaba.com/");
sb.append(str);
sb.append("/get_aid/?auth[token]=");
sb.append(str2);
sb.append("&type=utdid&id=");
sb.append(str3);
sb.append("&aid=");
sb.append(str4);
return sb.toString();
}
}