Return null calendar list on error

pull/699/head
Alex Baker 7 years ago
parent fb09501aa4
commit 1e597f583a

@ -127,7 +127,7 @@ class CaldavClient {
1, ResourceType.NAME, DisplayName.NAME, SupportedCalendarComponentSet.NAME, GetCTag.NAME);
} catch (IOException | HttpException | DavException e) {
Timber.e(e);
return emptyList();
return null;
}
List<DavResource> urls = new ArrayList<>();
for (DavResource member : davResource.getMembers()) {
@ -152,19 +152,4 @@ class CaldavClient {
}
return urls;
}
public Single<String> getDisplayName() {
Callable<String> callable =
() -> {
davResource.propfind(0, DisplayName.NAME);
DisplayName displayName = davResource.getProperties().get(DisplayName.class);
if (displayName == null) {
throw new DisplayableException(R.string.calendar_not_found);
}
return displayName.getDisplayName();
};
return Single.fromCallable(callable)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
}

@ -102,6 +102,9 @@ public class CaldavSynchronizer {
}
CaldavClient caldavClient = new CaldavClient(account, encryption);
List<DavResource> resources = caldavClient.getCalendars();
if (resources == null) {
continue;
}
Set<String> urls = newHashSet(transform(resources, c -> c.getLocation().toString()));
Timber.d("Found calendars: %s", urls);
for (CaldavCalendar deleted :

Loading…
Cancel
Save