diff --git a/app/src/androidTest/java/org/fdroid/download/DnsCacheTest.kt b/app/src/androidTest/java/org/fdroid/download/DnsCacheTest.kt index 13bdd9eff..ddad92633 100644 --- a/app/src/androidTest/java/org/fdroid/download/DnsCacheTest.kt +++ b/app/src/androidTest/java/org/fdroid/download/DnsCacheTest.kt @@ -9,7 +9,6 @@ import kotlin.test.assertNotNull import kotlin.test.assertNull import kotlin.test.assertTrue import org.fdroid.settings.SettingsManager -import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith @@ -82,7 +81,6 @@ class DnsCacheTest { } @Test - @Ignore("failing") // TODO fun preloadCacheTest() { // test setup settings.useDnsCache = true diff --git a/app/src/main/kotlin/org/fdroid/download/DnsWithCache.kt b/app/src/main/kotlin/org/fdroid/download/DnsWithCache.kt index 04aaa068b..8dada7485 100644 --- a/app/src/main/kotlin/org/fdroid/download/DnsWithCache.kt +++ b/app/src/main/kotlin/org/fdroid/download/DnsWithCache.kt @@ -26,8 +26,8 @@ constructor(private val settingsManager: SettingsManager, private val cache: Dns } /** - * these methods provide a way to pre-load the cache with values from other sources such as - * the mirror info from the index, further reducing the needs to do DNS lookups + * these methods provide a way to preload the cache with values from other sources such as the + * mirror info from the index, further reducing the needs to do DNS lookups */ fun populateCacheWithStrings(hostname: String, ipv4List: List, ipv6List: List) { val ipv4ConvertedList = stringListToIpList(ipv4List) @@ -35,7 +35,11 @@ constructor(private val settingsManager: SettingsManager, private val cache: Dns populateCacheWithIps(hostname, ipv4ConvertedList, ipv6ConvertedList) } - fun populateCacheWithIps(hostname: String, ipv4List: List, ipv6List: List) { + fun populateCacheWithIps( + hostname: String, + ipv4List: List, + ipv6List: List, + ) { // at this time, the DNS cache only supports a single collection because that's what the DNS // lookup method returns. since these values are being inserted manually, it's possible that // the cache might end up with values that wouldn't have been returned by the lookup method. @@ -55,12 +59,12 @@ constructor(private val settingsManager: SettingsManager, private val cache: Dns try { InetAddress.getByName(it) } catch (e: UnknownHostException) { - log.warn { "Unexpected format for IP address: $it" } + log.error(e) { "Unexpected format for IP address: $it" } null } } } catch (e: Exception) { - log.warn { "Failed to parse list of IP addresses, returning empty list" } + log.error(e) { "Failed to parse list of IP addresses, returning empty list" } return emptyList() } }