Skip to content

Commit

Permalink
Handle exceptions caused by json outputs
Browse files Browse the repository at this point in the history
If log file size is too large, the system returns FALSE with an empty
string as json output.
  • Loading branch information
sonertari committed Aug 3, 2021
1 parent 0ff8e77 commit 5280b02
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/src/main/java/org/comixwall/pffw/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ public String execute(String model, String cmd, Object... args) throws Exception
}

logger.finest("Controller execute output= " + output);

if (!output.isEmpty()) {
JSONArray jsonArray = new JSONArray(output);
if (jsonArray.getInt(2) == 1) {
throw new Exception(jsonArray.get(1).toString());
}
}
return output;
}

Expand Down

0 comments on commit 5280b02

Please sign in to comment.