Show specific message if the server doesn't support WebDAV

Fix wrong exception exposed
This commit is contained in:
Julian Raufelder 2022-02-04 15:45:59 +01:00
parent d93624c5dd
commit f10ac8798a
No known key found for this signature in database
GPG Key ID: 17EE71F6634E381D
4 changed files with 14 additions and 8 deletions

View File

@ -2,6 +2,7 @@ package org.cryptomator.data.cloud.webdav
import android.content.Context
import org.cryptomator.data.cloud.webdav.network.ConnectionHandlerHandlerImpl
import org.cryptomator.data.cloud.webdav.network.ServerNotWebdavCompatibleException
import org.cryptomator.data.util.CopyStream
import org.cryptomator.data.util.TransferredBytesAwareInputStream
import org.cryptomator.data.util.TransferredBytesAwareOutputStream
@ -14,6 +15,7 @@ import org.cryptomator.domain.exception.FatalBackendException
import org.cryptomator.domain.exception.NotFoundException
import org.cryptomator.domain.exception.ParentFolderDoesNotExistException
import org.cryptomator.domain.exception.ParentFolderIsNullException
import org.cryptomator.domain.exception.authentication.WebDavNotSupportedException
import org.cryptomator.domain.usecases.ProgressAware
import org.cryptomator.domain.usecases.cloud.DataSource
import org.cryptomator.domain.usecases.cloud.DownloadState
@ -142,7 +144,11 @@ internal class WebDavImpl(private val cloud: WebDavCloud, private val connection
@Throws(BackendException::class)
fun checkAuthenticationAndServerCompatibility(url: String) {
connectionHandler.checkAuthenticationAndServerCompatibility(url)
try {
connectionHandler.checkAuthenticationAndServerCompatibility(url)
} catch (ex: ServerNotWebdavCompatibleException) {
throw WebDavNotSupportedException(cloud)
}
}
@Throws(BackendException::class, IOException::class)

View File

@ -0,0 +1,7 @@
package org.cryptomator.data.cloud.webdav.network;
import org.cryptomator.domain.exception.BackendException;
public class ServerNotWebdavCompatibleException extends BackendException {
}

View File

@ -10,7 +10,6 @@ import org.cryptomator.domain.exception.FatalBackendException
import org.cryptomator.domain.exception.ForbiddenException
import org.cryptomator.domain.exception.NotFoundException
import org.cryptomator.domain.exception.ParentFolderDoesNotExistException
import org.cryptomator.domain.exception.ServerNotWebdavCompatibleException
import org.cryptomator.domain.exception.TypeMismatchException
import org.cryptomator.domain.exception.UnauthorizedException
import org.xmlpull.v1.XmlPullParserException
@ -18,7 +17,6 @@ import java.io.ByteArrayInputStream
import java.io.IOException
import java.io.InputStream
import java.net.HttpURLConnection
import java.util.ArrayList
import java.util.Collections
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.Request

View File

@ -1,5 +0,0 @@
package org.cryptomator.domain.exception;
public class ServerNotWebdavCompatibleException extends BackendException {
}