Go back to dnsjava 2.1.9 to avoid crashes on Android 7 (bitfireAT/davx5#454)

This commit is contained in:
Ricki Hirner 2023-11-13 14:23:55 +01:00
parent 2a9c27d4f7
commit eeffbdcf6d
No known key found for this signature in database
GPG key ID: 79A019FCAAEDD3AA
2 changed files with 6 additions and 17 deletions

View file

@ -185,7 +185,8 @@ dependencies {
implementation "com.squareup.okhttp3:logging-interceptor:${versions.okhttp}"
//noinspection GradleDependency - don't update until API level 26 (Android 8) is the minimum API [https://github.com/bitfireAT/davx5/issues/130]
implementation 'commons-io:commons-io:2.8.0'
implementation 'dnsjava:dnsjava:3.5.3'
//noinspection GradleDependency - dnsjava 3.x requires Android 8 [https://github.com/bitfireAT/davx5/issues/453]
implementation 'dnsjava:dnsjava:2.1.9'
implementation "io.github.nsk90:kstatemachine-jvm:0.22.1"
implementation 'net.openid:appauth:0.11.1'
implementation "org.apache.commons:commons-collections4:${versions.commonsCollections}"

View file

@ -11,12 +11,11 @@ import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.asExecutor
import kotlinx.coroutines.runBlocking
import org.xbill.DNS.EDNSOption
import org.xbill.DNS.Message
import org.xbill.DNS.Resolver
import org.xbill.DNS.ResolverListener
import org.xbill.DNS.TSIG
import java.time.Duration
import java.io.IOException
/**
* dnsjava Resolver that uses Android's [DnsResolver] API, which is available since Android 10.
@ -37,14 +36,14 @@ object Android10Resolver: Resolver {
}
override fun onError(error: DnsResolver.DnsException) {
future.completeExceptionally(error)
// wrap into IOException as expected by dnsjava
future.completeExceptionally(IOException(error))
}
})
future.await()
}
@Deprecated("Deprecated in dnsjava")
override fun sendAsync(query: Message, listener: ResolverListener) =
// currently not used by dnsjava, so no need to implement it
throw NotImplementedError()
@ -66,12 +65,7 @@ object Android10Resolver: Resolver {
// not applicable
}
override fun setEDNS(
version: Int,
payloadSize: Int,
flags: Int,
options: MutableList<EDNSOption>?
) {
override fun setEDNS(level: Int, payloadSize: Int, flags: Int, options: MutableList<Any?>?) {
// not applicable
}
@ -79,18 +73,12 @@ object Android10Resolver: Resolver {
// not applicable
}
@Deprecated("Deprecated in dnsjava")
override fun setTimeout(secs: Int, msecs: Int) {
// not applicable
}
@Deprecated("Deprecated in dnsjava")
override fun setTimeout(secs: Int) {
// not applicable
}
override fun setTimeout(timeout: Duration?) {
// not applicable
}
}