SaveCalendar: reuse property factory

Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
This commit is contained in:
Álvaro Brey 2022-08-19 12:44:28 +02:00
parent 8e751eedab
commit 9ab052d379

View file

@ -60,6 +60,7 @@ import net.fortuna.ical4j.model.DateTime;
import net.fortuna.ical4j.model.Dur; import net.fortuna.ical4j.model.Dur;
import net.fortuna.ical4j.model.Period; import net.fortuna.ical4j.model.Period;
import net.fortuna.ical4j.model.Property; import net.fortuna.ical4j.model.Property;
import net.fortuna.ical4j.model.PropertyFactoryImpl;
import net.fortuna.ical4j.model.PropertyFactoryRegistry; import net.fortuna.ical4j.model.PropertyFactoryRegistry;
import net.fortuna.ical4j.model.PropertyList; import net.fortuna.ical4j.model.PropertyList;
import net.fortuna.ical4j.model.TimeZone; import net.fortuna.ical4j.model.TimeZone;
@ -103,7 +104,7 @@ import java.util.UUID;
public class SaveCalendar { public class SaveCalendar {
private static final String TAG = "ICS_SaveCalendar"; private static final String TAG = "ICS_SaveCalendar";
//private final PropertyFactoryImpl mPropertyFactory = new PropertyFactoryRegistry() private final PropertyFactoryImpl mPropertyFactory = new PropertyFactoryRegistry();
private TimeZoneRegistry mTzRegistry; private TimeZoneRegistry mTzRegistry;
private final Set<TimeZone> mInsertedTimeZones = new HashSet<>(); private final Set<TimeZone> mInsertedTimeZones = new HashSet<>();
private final Set<String> mFailedOrganisers = new HashSet<>(); private final Set<String> mFailedOrganisers = new HashSet<>();
@ -553,7 +554,7 @@ public class SaveCalendar {
try { try {
String value = getString(cur, dbName); String value = getString(cur, dbName);
if (value != null) { if (value != null) {
Property p = new PropertyFactoryRegistry().createProperty(evName); Property p = mPropertyFactory.createProperty(evName);
p.setValue(value); p.setValue(value);
l.add(p); l.add(p);
return value; return value;
@ -571,7 +572,7 @@ public class SaveCalendar {
if (i != -1 && !cur.isNull(i)) { if (i != -1 && !cur.isNull(i)) {
int value = (int) cur.getLong(i); int value = (int) cur.getLong(i);
if (value >= 0 && value < vals.size() && vals.get(value) != null) { if (value >= 0 && value < vals.size() && vals.get(value) != null) {
Property p = new PropertyFactoryRegistry().createProperty(evName); Property p = mPropertyFactory.createProperty(evName);
p.setValue(vals.get(value)); p.setValue(vals.get(value));
l.add(p); l.add(p);
} }