Browse Source

KERNEL-216 去掉奇葩的JsonDecode使用

bugfix/10.0
richie 6 years ago
parent
commit
8094f08ff9
  1. 7
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java
  2. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java

7
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java

@ -17,10 +17,11 @@ import com.fr.design.mainframe.alphafine.search.manager.impl.RecommendSearchMana
import com.fr.design.mainframe.alphafine.search.manager.impl.SimilarSearchManager;
import com.fr.general.ProcessCanceledException;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSON;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONFactory;
import com.fr.json.JSONObject;
import com.fr.json.JSONUtils;
import com.fr.stable.StringUtils;
import java.util.List;
@ -110,7 +111,7 @@ public class AlphaFineHelper {
public static SearchResult getModelListFromJSONArray(String result, String keyword) throws ClassCastException, JSONException {
SearchResult allModelList = new SearchResult();
JSONArray jsonArray = (JSONArray) JSONUtils.jsonDecode(result);
JSONArray jsonArray = JSONFactory.createJSON(JSON.ARRAY, result);
for (int i = 0; i < jsonArray.length(); i++) {
AlphaFineHelper.checkCancel();
JSONObject jsonObject = jsonArray.optJSONObject(i);
@ -128,6 +129,7 @@ public class AlphaFineHelper {
/**
* 网络异常时的处理
*
* @param object
* @return
*/
@ -153,6 +155,7 @@ public class AlphaFineHelper {
/**
* 判断网络是否异常
*
* @return
*/
public static boolean isNetworkOk() {

4
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java

@ -6,8 +6,10 @@ import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.cell.model.RobotModel;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSON;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONFactory;
import com.fr.json.JSONObject;
import com.fr.json.JSONUtils;
import com.fr.log.FineLoggerFactory;
@ -73,7 +75,7 @@ public class HotIssuesManager {
try {
String result = HttpToolbox.get(AlphaFineConstants.ALPHA_HOT_SEARCH);
JSONArray jsonArray = (JSONArray)JSONUtils.jsonDecode(result);
JSONArray jsonArray = JSONFactory.createJSON(JSON.ARRAY, result);
if(jsonArray != null){
for (int i = 0; i < HOT_ITEM_NUM; i++) {
AlphaFineHelper.checkCancel();

Loading…
Cancel
Save