Commit ea01dcd5 authored by Ricki Hirner's avatar Ricki Hirner 🐑

Ignore empty strings when processing locally stored events

parent 5b6ab803
Pipeline #96408237 passed with stages
in 4 minutes and 48 seconds
......@@ -110,13 +110,15 @@ abstract class AndroidEvent(
field = event
val e = iterEvents.next()
populateEvent(e.entityValues)
populateEvent(MiscUtils.removeEmptyStrings(e.entityValues))
for (subValue in e.subValues)
for (subValue in e.subValues) {
val subValues = MiscUtils.removeEmptyStrings(subValue.values)
when (subValue.uri) {
Attendees.CONTENT_URI -> populateAttendee(subValue.values)
Reminders.CONTENT_URI -> populateReminder(subValue.values)
ExtendedProperties.CONTENT_URI -> populateExtended(subValue.values)
Attendees.CONTENT_URI -> populateAttendee(subValues)
Reminders.CONTENT_URI -> populateReminder(subValues)
ExtendedProperties.CONTENT_URI -> populateExtended(subValues)
}
}
populateExceptions()
......
......@@ -85,15 +85,17 @@ object MiscUtils {
/**
* Removes empty [String] values from [values].
*
* @param values set of values to be processed
* @param values set of values to be modified
* @return the modified object (which is the same object as passed in; for chaining)
*/
fun removeEmptyStrings(values: ContentValues) {
fun removeEmptyStrings(values: ContentValues): ContentValues {
val it = values.keySet().iterator()
while (it.hasNext()) {
val obj = values[it.next()]
if (obj is String && obj.isEmpty())
it.remove()
}
return values
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment