You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -125,15 +128,19 @@ class RepoUpdater(repoData2: RepoData) {
125
128
126
129
funfinish(): Boolean {
127
130
val success =AtomicBoolean(false)
131
+
Timber.d("Finishing update for %s", repoData.preferenceId)
128
132
// If repo is not enabled we don't need to do anything, just return true
129
133
if (!repoData.isEnabled) {
134
+
Timber.d("Repo %s is disabled, skipping", repoData.preferenceId)
130
135
returntrue
131
136
}
132
137
if (indexRaw !=null) {
138
+
val tmpIndexRaw = indexRaw!!
139
+
Timber.d("Updating database for %s", repoData.preferenceId)
133
140
// new thread to update the database
134
141
val thread =Thread {
135
142
val startTime =System.currentTimeMillis()
136
-
Timber.d("Updating database for %s", repoData.preferenceId)
143
+
Timber.d("Updating database thread for %s", repoData.preferenceId)
137
144
try {
138
145
// iterate over modules, using this.supportedProperties as a template to attempt to get each property from the module. everything that is not null is added to the module
139
146
// use room to insert to
@@ -145,31 +152,38 @@ class RepoUpdater(repoData2: RepoData) {
145
152
).build()
146
153
// all except first six can be null
147
154
// this.indexRaw is the raw index file (json)
148
-
val modules =JSONObject(String(indexRaw!!, StandardCharsets.UTF_8))
155
+
val modules =JSONObject(String(tmpIndexRaw, StandardCharsets.UTF_8))
149
156
// androidacy repo uses "data" key, others should use "modules" key. Both are JSONArrays
150
-
val modulesArray:JSONArray=if (repoData.preferenceId =="androidacy_repo") {
151
-
// get modules from "data" key. This is a JSONArray so we need to convert it to a JSONObject
157
+
val modulesArray =try {
152
158
modules.getJSONArray("data")
153
-
} else {
154
-
// get modules from "modules" key. This is a JSONArray so we need to convert it to a JSONObject
159
+
} catch (e:Exception) {
155
160
modules.getJSONArray("modules")
161
+
} catch (e:Exception) {
162
+
Timber.e(e)
163
+
Timber.w("No modules were found in the index file for %s", repoData.preferenceId)
164
+
Timber.d("Finished updating database for %s in %dms", repoData.preferenceId, System.currentTimeMillis() - startTime)
165
+
success.set(false)
166
+
return@Thread
156
167
}
168
+
Timber.d("Got modules for %s", repoData.preferenceId)
0 commit comments