Commit 613b88ad authored by Ricki Hirner's avatar Ricki Hirner

Fix crash in resource detection

parent b09d6c13
......@@ -65,9 +65,24 @@ class DavResourceFinder(
}
/**
* Finds the initial configuration, i.e. runs the auto-detection process. Must not throw an
* exception, but return an empty Configuration with error logs instead.
*/
fun findInitialConfiguration(): Configuration {
val cardDavConfig = findInitialConfiguration(Service.CARDDAV)
val calDavConfig = findInitialConfiguration(Service.CALDAV)
var cardDavConfig: Configuration.ServiceInfo?
var calDavConfig: Configuration.ServiceInfo?
try {
cardDavConfig = findInitialConfiguration(Service.CARDDAV)
calDavConfig = findInitialConfiguration(Service.CALDAV)
} catch(e: Exception) {
log.log(Level.INFO, "Service detection failed", e)
// reset results so that an error message will be shown
cardDavConfig = null
calDavConfig = null
}
return Configuration(
loginInfo.credentials,
......@@ -380,6 +395,10 @@ class DavResourceFinder(
return principal
}
/**
* Re-throws the exception if it signals that the current thread was interrupted
* to stop the current operation.
*/
private fun rethrowIfInterrupted(e: Exception) {
if (e is InterruptedIOException || e is InterruptedException)
throw e
......
......@@ -16,7 +16,6 @@
<string name="account_title_address_book">DAVdroid Address book</string>
<string name="address_books_authority" translatable="false">at.bitfire.davdroid.addressbooks</string>
<string name="address_books_authority_title">Address books</string>
<string name="copied_to_clipboard">Copied to clipboard</string>
<string name="help">Help</string>
<string name="manage_accounts">Manage accounts</string>
<string name="please_wait">Please wait …</string>
......
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