package com.ea.nimble; import com.ea.nimble.Error; import com.ea.nimble.Log; import java.util.Map; import org.json.JSONObject; /* loaded from: classes2.dex */ public class SynergyResponse implements ISynergyResponse { public IHttpResponse httpResponse = null; public Error error = null; public Map jsonData = null; public void parseData() { int intValue; Log.Helper.LOGPUBLICFUNC(this); if (this.jsonData != null) { return; } IHttpResponse iHttpResponse = this.httpResponse; if (iHttpResponse == null || iHttpResponse.getError() != null) { this.jsonData = null; this.error = null; return; } String str = ""; try { str = Utility.readStringFromStream(this.httpResponse.getDataStream()); Map convertJSONObjectToMap = Utility.convertJSONObjectToMap(new JSONObject(str)); this.jsonData = convertJSONObjectToMap; if (!convertJSONObjectToMap.containsKey("resultCode") || (intValue = ((Integer) this.jsonData.get("resultCode")).intValue()) >= 0) { return; } this.error = new SynergyServerError(intValue, (String) this.jsonData.get("message")); } catch (Exception e) { this.jsonData = null; this.error = new Error(Error.Code.NETWORK_INVALID_SERVER_RESPONSE, "Unparseable synergy json response " + str, e); } } @Override // com.ea.nimble.ISynergyResponse public IHttpResponse getHttpResponse() { Log.Helper.LOGPUBLICFUNC(this); return this.httpResponse; } @Override // com.ea.nimble.ISynergyResponse public boolean isCompleted() { Log.Helper.LOGPUBLICFUNC(this); IHttpResponse iHttpResponse = this.httpResponse; if (iHttpResponse == null) { return false; } return iHttpResponse.isCompleted(); } @Override // com.ea.nimble.ISynergyResponse public Exception getError() { IHttpResponse iHttpResponse; Error error = this.error; return (error != null || (iHttpResponse = this.httpResponse) == null) ? error : iHttpResponse.getError(); } @Override // com.ea.nimble.ISynergyResponse public Map getJsonData() { Log.Helper.LOGPUBLICFUNC(this); return this.jsonData; } }