Skip to content

Commit

Permalink
fix: add exception handling (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhicheng-ning authored Dec 11, 2023
1 parent e807603 commit 8171137
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/cn/nzcer/odapi/cron/SyncDataBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,13 @@ public Set<String> parseRepo(String url) throws IOException {
public Set<String> parseRepo(String url, int count) throws IOException {
JSONObject jsonObject = NetUtil.doGet(url);
Set<String> repoNames = new HashSet<>();
JSONArray jsonArray = jsonObject.getJSONArray("data");
JSONArray jsonArray = null;
try {
jsonArray = jsonObject.getJSONArray("data");
} catch (Exception e) {
e.printStackTrace();
return repoNames;
}
int cnt = 0;
for (int i = 0; i < jsonArray.size(); i++) {
String repoName = jsonArray.getJSONObject(i).getJSONObject("item").getString("name");
Expand Down

0 comments on commit 8171137

Please sign in to comment.