xstream permission

This commit is contained in:
Radoslaw 2021-09-03 00:01:45 +02:00
parent 4d5b699cc4
commit 991b1257d1

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))