Skip to content

Commit

Permalink
fix: monkey fastjson bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhouYixun committed Nov 3, 2022
1 parent a104ad1 commit f159637
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package org.cloud.sonic.agent.automation;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.android.ddmlib.IDevice;
Expand Down Expand Up @@ -941,7 +942,7 @@ public void runMonkey(HandleDes handleDes, JSONObject content, List<JSONObject>
handleDes.setE(new Exception("未安装应用"));
return;
}
List<JSONObject> options = content.getJSONArray("options").toJavaList(JSONObject.class);
JSONArray options = content.getJSONArray("options");
WindowSize windowSize = null;
try {
windowSize = androidDriver.getWindowSize();
Expand All @@ -961,7 +962,8 @@ public void runMonkey(HandleDes handleDes, JSONObject content, List<JSONObject>
boolean isOpenActivityListener = false;
boolean isOpenNetworkListener = false;
if (!options.isEmpty()) {
for (JSONObject jsonOption : options) {
for (Object j : options) {
JSONObject jsonOption = JSON.parseObject(j.toString());
if (jsonOption.getString("name").equals("sleepTime")) {
sleepTime = jsonOption.getInteger("value");
}
Expand Down Expand Up @@ -1103,7 +1105,6 @@ public void runMonkey(HandleDes handleDes, JSONObject content, List<JSONObject>
h5Time = 0;
}
} catch (Throwable e) {
e.printStackTrace();
}
}
}
Expand Down

0 comments on commit f159637

Please sign in to comment.