VegeFruits v7.1版本的 MD5 值为:2ff167dfba698c783e879938fe00b9ce
以下内容为反编译后的 ak.java 源代码,内容仅作参考
package com.chartboost.sdk.impl;
import android.content.SharedPreferences;
import com.amazon.device.ads.WebRequest;
import com.chartboost.sdk.Libraries.CBLogging;
import com.chartboost.sdk.Libraries.CBUtility;
import com.chartboost.sdk.Libraries.d;
import com.chartboost.sdk.Libraries.f;
import com.chartboost.sdk.Model.CBError;
import com.chartboost.sdk.impl.ac;
import com.chartboost.sdk.impl.aj;
import com.tapjoy.TJAdUnitConstants;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import org.json.JSONObject;
public class ak {
public final com.chartboost.sdk.Libraries.c a;
final ai b;
final ay c;
public final AtomicReference<com.chartboost.sdk.Model.c> d;
final SharedPreferences e;
public final com.chartboost.sdk.Tracking.a f;
final af g;
private final List<Runnable> h = new ArrayList();
public ak(af afVar, ai aiVar, ay ayVar, AtomicReference<com.chartboost.sdk.Model.c> atomicReference, SharedPreferences sharedPreferences) {
this.a = (com.chartboost.sdk.Libraries.c) com.chartboost.sdk.g.a().a((com.chartboost.sdk.g) new com.chartboost.sdk.Libraries.c(this, sharedPreferences));
this.g = afVar;
this.b = aiVar;
this.c = ayVar;
this.d = atomicReference;
this.e = sharedPreferences;
this.f = (com.chartboost.sdk.Tracking.a) com.chartboost.sdk.g.a().a((com.chartboost.sdk.g) new com.chartboost.sdk.Tracking.a(this, atomicReference, sharedPreferences));
}
void a(aj ajVar, ah ahVar, CBError cBError, boolean z) {
if (ajVar != null) {
d.a[] aVarArr = new d.a[5];
aVarArr[0] = com.chartboost.sdk.Libraries.d.a("endpoint", ajVar.d());
aVarArr[1] = com.chartboost.sdk.Libraries.d.a("statuscode", ahVar == null ? "None" : Integer.valueOf(ahVar.b()));
aVarArr[2] = com.chartboost.sdk.Libraries.d.a(TJAdUnitConstants.String.VIDEO_ERROR, cBError == null ? "None" : cBError.a());
aVarArr[3] = com.chartboost.sdk.Libraries.d.a("errorDescription", cBError == null ? "None" : cBError.b());
aVarArr[4] = com.chartboost.sdk.Libraries.d.a("retryCount", (Object) 0);
this.f.a("request_manager", "request", z ? "success" : "failure", (String) null, (String) null, (String) null, com.chartboost.sdk.Libraries.d.a(aVarArr));
}
}
public void a(aj ajVar, aj.a aVar) {
if (ajVar != null) {
if (!this.b.b()) {
CBError cBError = new CBError(CBError.a.INTERNET_UNAVAILABLE, "Internet Unavailable");
if (!ajVar.e()) {
a(ajVar, null, cBError, false);
if (aVar != null) {
CBLogging.b("Network failure", String.format("request %s failed with error : %s", ajVar.d(), cBError.b()));
aVar.a((JSONObject) com.chartboost.sdk.g.a().a((com.chartboost.sdk.g) new JSONObject()), ajVar, cBError);
return;
}
return;
}
return;
}
this.g.a(new c(ac.a.POST, String.format("%s%s", "https://live.chartboost.com", ajVar.b()), ajVar));
}
}
public class c extends ac<b> {
private final aj i;
public c(ac.a aVar, String str, aj ajVar) {
super(aVar, str, null, null);
this.i = ajVar;
}
@Override
public aq a() {
this.i.a();
String str = com.chartboost.sdk.i.k;
String b = com.chartboost.sdk.Libraries.b.b(com.chartboost.sdk.Libraries.b.a(String.format(Locale.US, "%s %s\n%s\n%s", this.b, this.i.b(), com.chartboost.sdk.i.l, this.i.c()).getBytes()));
HashMap hashMap = new HashMap();
hashMap.put("Accept", WebRequest.CONTENT_TYPE_JSON);
hashMap.put("X-Chartboost-Client", CBUtility.b());
hashMap.put("X-Chartboost-API", "6.6.3");
hashMap.put("X-Chartboost-App", str);
hashMap.put("X-Chartboost-Signature", b);
return new aq(hashMap, (this.i.f() == null ? "" : this.i.f().toString()).getBytes(), WebRequest.CONTENT_TYPE_JSON);
}
@Override
public ac.b b() {
return this.i.h();
}
@Override
public ae<b> a(ah ahVar) {
JSONObject jSONObject;
Exception e;
CBError cBError;
JSONObject jSONObject2 = null;
jSONObject2 = null;
r0 = null;
CBError cBError2 = null;
int b = ahVar.b();
if (b > 300 && b < 200) {
CBLogging.b("CBRequestManager", "Request " + this.i.d() + " failed. Response code: " + b);
cBError = new CBError(CBError.a.NETWORK_FAILURE, "Request failed. Response code: " + b + " is not valid ");
} else {
try {
byte[] a = ahVar.a();
String str = a != null ? new String(a) : null;
if (str != null) {
jSONObject = g.a().a(str);
try {
f.a g = this.i.g();
CBLogging.c("CBRequestManager", "Request " + this.i.d() + " succeeded. Response code: " + b + ", body: " + jSONObject.toString(4));
if (jSONObject.optInt("status") == 404) {
cBError2 = new CBError(CBError.a.HTTP_NOT_FOUND, "404 error from server");
} else {
StringBuilder sb = new StringBuilder();
if (g != null && !g.a(jSONObject, sb)) {
cBError2 = new CBError(CBError.a.UNEXPECTED_RESPONSE, "Json response failed validation");
CBLogging.b("CBRequestManager", "Json response failed validation: " + sb.toString());
}
}
cBError = cBError2;
jSONObject2 = jSONObject;
} catch (Exception e2) {
e = e2;
CBError cBError3 = new CBError(CBError.a.MISCELLANEOUS, e.getLocalizedMessage());
com.chartboost.sdk.Tracking.a.a(getClass(), "parseServerResponse", e);
jSONObject2 = jSONObject;
cBError = cBError3;
if (jSONObject2 == null) {
}
return ae.a((Exception) new a(cBError));
}
} else {
cBError = new CBError(CBError.a.INVALID_RESPONSE, "Response is not a valid json object");
}
} catch (Exception e3) {
jSONObject = null;
e = e3;
}
}
if (jSONObject2 == null && cBError == null) {
return ae.a(new b(jSONObject2, ahVar));
}
return ae.a((Exception) new a(cBError));
}
@Override
public void a(b bVar) {
if (this.i.i() != null && bVar != null) {
this.i.i().a(bVar.a, this.i);
}
if (!this.i.e()) {
ak.this.a(this.i, bVar.b, null, true);
}
}
@Override
public void a(ad adVar) {
CBError cBError;
if (adVar != null) {
if (adVar.b instanceof a) {
cBError = ((a) adVar.b).a;
} else if (adVar.b != null && (adVar.b.getCause() instanceof a)) {
cBError = ((a) adVar.b.getCause()).a;
} else {
cBError = new CBError(CBError.a.NETWORK_FAILURE, adVar.a());
}
JSONObject jSONObject = null;
try {
if (adVar.a != null && adVar.a.a() != null && adVar.a.a().length > 0) {
jSONObject = g.a().a(new String(adVar.a.a()));
}
} catch (Exception e) {
CBLogging.d("CBRequestManager", "unable to read error json", e);
}
if (jSONObject == null) {
jSONObject = (JSONObject) com.chartboost.sdk.g.a().a((com.chartboost.sdk.g) new JSONObject());
}
if (adVar.a != null && adVar.a.b() == 200) {
a(new b(jSONObject, adVar.a));
return;
}
if (this.i.i() != null) {
this.i.i().a(jSONObject, this.i, cBError);
}
if (!this.i.e()) {
ak.this.a(this.i, adVar.a, cBError, false);
}
}
}
}
public static class a extends RuntimeException {
final CBError a;
public a(CBError cBError) {
this.a = cBError;
}
}
public static class b {
final JSONObject a;
final ah b;
public b(JSONObject jSONObject, ah ahVar) {
this.a = jSONObject;
this.b = ahVar;
}
}
public Map<String, String> a() {
HashMap hashMap = new HashMap();
String num = Integer.toString(this.b.a());
hashMap.put("X-Chartboost-App", com.chartboost.sdk.i.k);
hashMap.put("X-Chartboost-Client", CBUtility.b());
hashMap.put("X-Chartboost-Reachability", num);
return hashMap;
}
}