File tree Expand file tree Collapse file tree
src/main/java/com/github/balloonupdate/mcpatch/client/data Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package com .github .balloonupdate .mcpatch .client .data ;
22
3+ import com .github .balloonupdate .mcpatch .client .exceptions .McpatchBusinessException ;
34import com .github .balloonupdate .mcpatch .client .logging .Log ;
45import org .json .JSONArray ;
56import org .json .JSONObject ;
@@ -17,10 +18,18 @@ public IndexFile() {
1718 versions = new ArrayList <>();
1819 }
1920
20- public static IndexFile loadFromJson (String json ) {
21+ public static IndexFile loadFromJson (String json ) throws McpatchBusinessException {
2122 IndexFile indexFile = new IndexFile ();
2223
23- JSONArray array = new JSONArray (json );
24+ JSONArray array ;
25+ try {
26+ array = new JSONArray (json );
27+ } catch (RuntimeException e ) {
28+ throw new McpatchBusinessException ("JSON解析失败,原始内容:\n " +json , e );
29+ // Log.error(e.toString());
30+ // Log.info("RawContent:\n" + json);
31+ // throw e;
32+ }
2433
2534 for (int i = 0 ; i < array .length (); i ++) {
2635 JSONObject element = array .getJSONObject (i );
You can’t perform that action at this time.
0 commit comments