mirror of
https://github.com/bitfireAT/davx5-ose.git
synced 2025-12-23 23:17:50 -05:00
Update dav4jvm (#1709)
- Replace `code` with `statusCode` in multiple files to align with the updated library - Add `dav4jvm` to Dependabot ignores
This commit is contained in:
4
.github/dependabot.yml
vendored
4
.github/dependabot.yml
vendored
@@ -25,4 +25,6 @@ updates:
|
||||
- dependency-name: "org.jetbrains.kotlin:kotlin-stdlib"
|
||||
- dependency-name: "org.jetbrains.kotlin.plugin.compose"
|
||||
- dependency-name: "org.jetbrains.kotlin.android"
|
||||
- dependency-name: "com.google.devtools.ksp"
|
||||
- dependency-name: "com.google.devtools.ksp"
|
||||
# dependencies without semantic versioning
|
||||
- dependency-name: "com.github.bitfireat:dav4jvm"
|
||||
@@ -63,7 +63,7 @@ class CollectionsWithoutHomeSetRefresher @AssistedInject constructor(
|
||||
}
|
||||
} catch (e: HttpException) {
|
||||
// delete collection locally if it was not accessible (40x)
|
||||
if (e.code in arrayOf(403, 404, 410))
|
||||
if (e.statusCode in arrayOf(403, 404, 410))
|
||||
collectionRepository.delete(localCollection)
|
||||
else
|
||||
throw e
|
||||
|
||||
@@ -103,7 +103,7 @@ class HomeSetRefresher @AssistedInject constructor(
|
||||
}
|
||||
} catch (e: HttpException) {
|
||||
// delete home set locally if it was not accessible (40x)
|
||||
if (e.code in arrayOf(403, 404, 410))
|
||||
if (e.statusCode in arrayOf(403, 404, 410))
|
||||
homeSetRepository.deleteBlocking(localHomeset)
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ class PrincipalsRefresher @AssistedInject constructor(
|
||||
}
|
||||
}
|
||||
} catch (e: HttpException) {
|
||||
logger.info("Principal update failed with response code ${e.code}. principalUrl=$principalUrl")
|
||||
logger.info("Principal update failed with response code ${e.statusCode}. principalUrl=$principalUrl")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ class ServiceRefresher @AssistedInject constructor(
|
||||
}
|
||||
}
|
||||
} catch (e: HttpException) {
|
||||
if (e.code / 100 == 4)
|
||||
if (e.isClientError)
|
||||
logger.log(Level.INFO, "Ignoring Client Error 4xx while looking for ${service.type} home sets", e)
|
||||
else
|
||||
throw e
|
||||
|
||||
@@ -114,14 +114,14 @@ class DebugInfoGenerator @Inject constructor(
|
||||
|
||||
// exception details
|
||||
if (cause is DavException) {
|
||||
cause.request?.let { request ->
|
||||
writer.append("HTTP REQUEST\n$request\n")
|
||||
cause.requestBody?.let { writer.append(it) }
|
||||
cause.requestExcerpt?.let { request ->
|
||||
writer.append("HTTP REQUEST\n")
|
||||
writer.append(request)
|
||||
writer.append("\n\n")
|
||||
}
|
||||
cause.response?.let { response ->
|
||||
writer.append("HTTP RESPONSE\n$response\n")
|
||||
cause.responseBody?.let { writer.append(it) }
|
||||
cause.responseExcerpt?.let { response ->
|
||||
writer.append("HTTP RESPONSE\n")
|
||||
writer.append(response)
|
||||
writer.append("\n\n")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ fun DebugInfoScreen(
|
||||
zipProgress = zipInProgress,
|
||||
showModelCause = cause != null,
|
||||
modelCauseTitle = when (cause) {
|
||||
is HttpException -> stringResource(if (cause.code / 100 == 5) R.string.debug_info_server_error else R.string.debug_info_http_error)
|
||||
is HttpException -> stringResource(if (cause.isServerError) R.string.debug_info_server_error else R.string.debug_info_http_error)
|
||||
is DavException -> stringResource(R.string.debug_info_webdav_error)
|
||||
is IOException, is IOError -> stringResource(R.string.debug_info_io_error)
|
||||
else -> cause?.let { it::class.java.simpleName }
|
||||
@@ -109,9 +109,9 @@ fun DebugInfoScreen(
|
||||
modelCauseMessage = stringResource(
|
||||
if (cause is HttpException)
|
||||
when {
|
||||
cause.code == 403 -> R.string.debug_info_http_403_description
|
||||
cause.code == 404 -> R.string.debug_info_http_404_description
|
||||
cause.code / 100 == 5 -> R.string.debug_info_http_5xx_description
|
||||
cause.statusCode == 403 -> R.string.debug_info_http_403_description
|
||||
cause.statusCode == 404 -> R.string.debug_info_http_404_description
|
||||
cause.isServerError -> R.string.debug_info_http_5xx_description
|
||||
else -> R.string.debug_info_unexpected_error
|
||||
}
|
||||
else
|
||||
|
||||
@@ -17,7 +17,6 @@ import at.bitfire.dav4jvm.exception.HttpException
|
||||
import at.bitfire.davdroid.R
|
||||
import at.bitfire.davdroid.ui.webdav.WebdavMountsActivity
|
||||
import java.io.FileNotFoundException
|
||||
import java.net.HttpURLConnection
|
||||
|
||||
object DocumentProviderUtils {
|
||||
|
||||
@@ -67,8 +66,8 @@ object DocumentProviderUtils {
|
||||
}
|
||||
|
||||
internal fun HttpException.throwForDocumentProvider(context: Context, ignorePreconditionFailed: Boolean = false) {
|
||||
when (code) {
|
||||
HttpURLConnection.HTTP_UNAUTHORIZED -> {
|
||||
when (statusCode) {
|
||||
401 -> {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
val intent = Intent(context, WebdavMountsActivity::class.java)
|
||||
throw AuthenticationRequiredException(
|
||||
@@ -79,9 +78,9 @@ internal fun HttpException.throwForDocumentProvider(context: Context, ignorePrec
|
||||
)
|
||||
}
|
||||
}
|
||||
HttpURLConnection.HTTP_NOT_FOUND ->
|
||||
404 ->
|
||||
throw FileNotFoundException()
|
||||
HttpURLConnection.HTTP_PRECON_FAILED ->
|
||||
412 ->
|
||||
if (ignorePreconditionFailed)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ import okhttp3.Headers
|
||||
import okhttp3.HttpUrl
|
||||
import okhttp3.MediaType
|
||||
import java.io.InterruptedIOException
|
||||
import java.net.HttpURLConnection
|
||||
import java.util.logging.Logger
|
||||
import javax.annotation.WillClose
|
||||
|
||||
@@ -161,9 +160,9 @@ class RandomAccessCallback @AssistedInject constructor(
|
||||
functionName,
|
||||
when (this) {
|
||||
is HttpException ->
|
||||
when (code) {
|
||||
HttpURLConnection.HTTP_FORBIDDEN -> OsConstants.EPERM
|
||||
HttpURLConnection.HTTP_NOT_FOUND -> OsConstants.ENOENT
|
||||
when (statusCode) {
|
||||
403 -> OsConstants.EPERM
|
||||
404 -> OsConstants.ENOENT
|
||||
else -> OsConstants.EIO
|
||||
}
|
||||
is IndexOutOfBoundsException -> OsConstants.ENXIO // no such [device or] address, see man lseek (2)
|
||||
|
||||
@@ -64,7 +64,7 @@ class StreamingFileDescriptor @AssistedInject constructor(
|
||||
success = true
|
||||
} catch (e: HttpException) {
|
||||
logger.log(Level.WARNING, "HTTP error when opening remote file", e)
|
||||
writeFd.closeWithError("${e.code} ${e.message}")
|
||||
writeFd.closeWithError("${e.statusCode} ${e.message}")
|
||||
} catch (e: Exception) {
|
||||
logger.log(Level.INFO, "Couldn't serve file (not necessarily an error)", e)
|
||||
writeFd.closeWithError(e.message)
|
||||
|
||||
@@ -19,7 +19,7 @@ androidx-test-rules = "1.7.0"
|
||||
androidx-test-junit = "1.3.0"
|
||||
androidx-work = "2.10.3"
|
||||
bitfire-cert4android = "41009d48ed"
|
||||
bitfire-dav4jvm = "cb6065b262"
|
||||
bitfire-dav4jvm = "f11523619b"
|
||||
bitfire-synctools = "fda79a4bd6"
|
||||
compose-accompanist = "0.37.3"
|
||||
compose-bom = "2025.08.01"
|
||||
|
||||
Reference in New Issue
Block a user