中建乐购 v3.2.2版本的 MD5 值为:0553721e6bc6ba8dd67004696a555b81
以下内容为反编译后的 b.java 源代码,内容仅作参考
package fn;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import fo.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 f18549a = "fn.b";
private static b f18550b;
private Context f18551c;
private Object f18552d = new Object();
class a extends Thread {
HttpPost f18553a;
String f18554b;
gh.a f18555c;
String f18556d;
String f18557e;
String f18558f;
public a(HttpPost httpPost) {
this.f18554b = "";
this.f18558f = "";
this.f18553a = httpPost;
}
public a(HttpPost httpPost, gh.a aVar, String str, String str2, String str3) {
this.f18554b = "";
this.f18558f = "";
this.f18553a = httpPost;
this.f18555c = aVar;
this.f18556d = str;
this.f18557e = str2;
this.f18558f = str3;
}
@Override
public final void run() {
HttpResponse httpResponse;
if (this.f18555c != null) {
this.f18555c.a(1000, this.f18556d);
}
BufferedReader bufferedReader = null;
try {
httpResponse = new DefaultHttpClient().execute(this.f18553a);
} catch (Exception e2) {
if (this.f18555c != null) {
this.f18555c.a(1002, this.f18556d);
}
Log.e(b.f18549a, e2.toString());
httpResponse = null;
}
try {
if (httpResponse == null) {
Log.e(b.f18549a, "response is null!");
} else {
bufferedReader = new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent(), Charset.forName("UTF-8")));
}
} catch (Exception e3) {
if (this.f18555c != null) {
this.f18555c.a(1002, this.f18556d);
}
Log.e(b.f18549a, e3.toString());
}
try {
if (bufferedReader != null) {
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
if (fo.c.f18581a) {
Log.d(b.f18549a, readLine);
}
this.f18554b = readLine;
}
} else {
Log.e(b.f18549a, "BufferredReader is null!");
}
} catch (Exception e4) {
if (this.f18555c != null) {
this.f18555c.a(1002, this.f18556d);
}
Log.e(b.f18549a, e4.toString());
}
if (bufferedReader != null) {
try {
bufferedReader.close();
if (fo.c.f18581a) {
Log.d(b.f18549a, "close the bufferreader");
}
} catch (IOException e5) {
Log.e(b.f18549a, e5.toString());
}
}
if (this.f18555c == null) {
synchronized (b.this.f18552d) {
b.this.f18552d.notifyAll();
}
return;
}
String b2 = b.b(this.f18554b, this.f18556d);
this.f18555c.a(1001, b2);
c.a(b.this.f18551c, this.f18557e, b2, this.f18558f);
}
public final String a() {
return this.f18554b;
}
}
public static synchronized b a(Context context) {
b bVar;
synchronized (b.class) {
if (f18550b == null) {
f18550b = new b(context);
}
bVar = f18550b;
}
return bVar;
}
private b(Context context) {
this.f18551c = context;
}
public final void a(String str, String str2, String str3, String str4, gh.a aVar) {
String b2 = b(str, str2, str3, str4);
if (fo.c.f18581a) {
String str5 = f18549a;
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.f18551c) ? 3000 : 1000;
if (fo.c.f18581a) {
String str5 = f18549a;
Log.d(str5, "url:" + b2 + "; timeout:" + i2);
}
a aVar = new a(new HttpPost(b2));
aVar.start();
try {
synchronized (this.f18552d) {
this.f18552d.wait(i2);
}
} catch (Exception e2) {
Log.e(f18549a, e2.toString());
}
String a2 = aVar.a();
if (fo.c.f18581a) {
String str6 = f18549a;
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(fj.b.f18308b) && !string3.equalsIgnoreCase("401")) {
return str2;
}
if (fo.c.f18581a) {
String str4 = f18549a;
Log.d(str4, "remove the AID, status:" + string3);
}
str3 = "";
}
return str3;
} catch (JSONException e2) {
Log.e(f18549a, e2.toString());
return str2;
} catch (Exception e3) {
Log.e(f18549a, 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();
}
}