Merge pull request #660 from rdziadosz/dev

Xstream permission
This commit is contained in:
Milos Kozak 2021-09-03 13:47:23 +02:00 committed by GitHub
commit ba4a8f3a1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.pump.common.sync
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import com.thoughtworks.xstream.security.AnyTypePermission
import com.thoughtworks.xstream.XStream
import info.nightscout.androidaps.data.DetailedBolusInfo
import info.nightscout.androidaps.interfaces.PumpSync
@ -45,6 +46,7 @@ class PumpSyncStorage @Inject constructor(
val jsonData: String = sp.getString(pumpSyncStorageKey, "");
if (jsonData.isNotBlank()) {
xstream.addPermission(AnyTypePermission.ANY)
pumpSyncStorage = xstream.fromXML(jsonData, MutableMap::class.java) as MutableMap<String, MutableList<PumpDbEntry>>
aapsLogger.debug(LTag.PUMP, String.format("Loading Pump Sync Storage: boluses=%d, tbrs=%d.", pumpSyncStorage[BOLUS]!!.size, pumpSyncStorage[TBR]!!.size))