Skip to content

Commit 8096e27

Browse files
committed
1 parent fd949d6 commit 8096e27

File tree

2 files changed

+13
-13
lines changed
  • core-websdk/src/main/java/net/xzos/upgradeall/core/websdk/api/client_proxy/cloud_config/migration

2 files changed

+13
-13
lines changed

core-websdk/src/main/java/net/xzos/upgradeall/core/websdk/api/client_proxy/cloud_config/migration/App.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ fun app1to2(oldJson: JSONObject): JSONObject? {
1111
else -> s.lowercase()
1212
}
1313

14-
if (oldJson.getInt("base_version") != 1) return null
14+
if (oldJson.optInt("base_version") != 1) return null
1515
val targetCheckerJson = oldJson.getJSONObject("app_config")
1616
.getJSONObject("target_checker")
1717
val map = mapOf(
1818
"base_version" to 2,
19-
"config_version" to oldJson.getJSONObject("info").getString("config_version"),
20-
"uuid" to oldJson.getString("uuid"),
19+
"config_version" to oldJson.getJSONObject("info").optInt("config_version"),
20+
"uuid" to oldJson.optString("uuid"),
2121
"base_hub_uuid" to oldJson.getJSONObject("app_config")
2222
.getJSONObject("hub_info")
23-
.getString("hub_uuid"),
23+
.optString("hub_uuid"),
2424
"info" to mapOf(
25-
"name" to oldJson.getJSONObject("info").getString("app_name"),
26-
"url" to oldJson.getJSONObject("info").getString("url"),
25+
"name" to oldJson.getJSONObject("info").optString("app_name"),
26+
"url" to oldJson.getJSONObject("info").optString("url"),
2727
"extra_map" to mapOf(
28-
apiConvert(targetCheckerJson.getString("api")) to targetCheckerJson.getString("extra_string")
28+
apiConvert(targetCheckerJson.getString("api")) to targetCheckerJson.optString("extra_string")
2929
)
3030
),
3131
)

core-websdk/src/main/java/net/xzos/upgradeall/core/websdk/api/client_proxy/cloud_config/migration/Hub.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ fun hub5to6(oldJson: JSONObject): JSONObject? {
77
"1c010cc9-cff8-4461-8993-a86cd190d377",
88
"6a6d590b-1809-41bf-8ce3-7e3f6c8da945",
99
)
10-
if (oldJson.getInt("base_version") != 5) return null
11-
val uuid = oldJson.getString("uuid")
10+
if (oldJson.optInt("base_version") != 5) return null
11+
val uuid = oldJson.optString("uuid")
1212
val map = mapOf(
1313
"base_version" to 6,
14-
"config_version" to oldJson.getJSONObject("info").getString("config_version"),
14+
"config_version" to oldJson.getJSONObject("info").optString("config_version"),
1515
"uuid" to uuid,
1616
"info" to mapOf(
17-
"hub_name" to oldJson.getJSONObject("info").getString("hub_name"),
17+
"hub_name" to oldJson.getJSONObject("info").optString("hub_name"),
1818
"hub_icon_url" to "",
1919
),
2020
"target_check_api" to if (uuid in versionCodeHubs) "index" else "version_number",
21-
"api_keywords" to oldJson.getJSONArray("api_keywords"),
22-
"app_url_templates" to oldJson.getJSONArray("app_url_templates"),
21+
"api_keywords" to oldJson.optJSONArray("api_keywords"),
22+
"app_url_templates" to oldJson.optJSONArray("app_url_templates"),
2323
)
2424
return JSONObject(map)
2525
}

0 commit comments

Comments
 (0)