Mute more SocketException
This commit is contained in:
@@ -138,14 +138,13 @@ class SettingsPreferenceFragment : PreferenceFragmentCompat() {
|
|||||||
.filter {
|
.filter {
|
||||||
try {
|
try {
|
||||||
it.isUp && !it.isLoopback && it.interfaceAddresses.isNotEmpty()
|
it.isUp && !it.isLoopback && it.interfaceAddresses.isNotEmpty()
|
||||||
} catch (e: SocketException) {
|
} catch (_: SocketException) {
|
||||||
Timber.d(e)
|
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.map { it.name }.sorted().toList().toTypedArray()
|
.map { it.name }.sorted().toList().toTypedArray()
|
||||||
} catch (e: SocketException) {
|
} catch (e: SocketException) {
|
||||||
Timber.d(e)
|
Timber.w(e)
|
||||||
emptyArray<String>()
|
emptyArray<String>()
|
||||||
})
|
})
|
||||||
setTargetFragment(this@SettingsPreferenceFragment, 0)
|
setTargetFragment(this@SettingsPreferenceFragment, 0)
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class RepeaterManager(private val parent: TetheringFragment) : Manager(), Servic
|
|||||||
val addresses: CharSequence @Bindable get() {
|
val addresses: CharSequence @Bindable get() {
|
||||||
return try {
|
return try {
|
||||||
NetworkInterface.getByName(p2pInterface ?: return "")?.formatAddresses() ?: ""
|
NetworkInterface.getByName(p2pInterface ?: return "")?.formatAddresses() ?: ""
|
||||||
} catch (e: SocketException) {
|
} catch (_: SocketException) {
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class TetheringFragment : Fragment(), ServiceConnection {
|
|||||||
ifaceLookup = try {
|
ifaceLookup = try {
|
||||||
NetworkInterface.getNetworkInterfaces().asSequence().associateBy { it.name }
|
NetworkInterface.getNetworkInterfaces().asSequence().associateBy { it.name }
|
||||||
} catch (e: SocketException) {
|
} catch (e: SocketException) {
|
||||||
Timber.d(e)
|
Timber.w(e)
|
||||||
emptyMap()
|
emptyMap()
|
||||||
}
|
}
|
||||||
this@TetheringFragment.enabledTypes =
|
this@TetheringFragment.enabledTypes =
|
||||||
|
|||||||
@@ -57,9 +57,7 @@ data class IpNeighbour(val ip: InetAddress, val dev: String, val lladdr: String,
|
|||||||
val iface = NetworkInterface.getByIndex(index)
|
val iface = NetworkInterface.getByIndex(index)
|
||||||
if (iface == null) Timber.w("Failed to find network interface #$index")
|
if (iface == null) Timber.w("Failed to find network interface #$index")
|
||||||
else return listOf(IpNeighbour(ip, iface.name, lladdr, state), result)
|
else return listOf(IpNeighbour(ip, iface.name, lladdr, state), result)
|
||||||
} catch (e: SocketException) {
|
} catch (_: SocketException) { }
|
||||||
Timber.d(e)
|
|
||||||
}
|
|
||||||
listOf(result)
|
listOf(result)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Timber.w(IllegalArgumentException("Unable to parse line: $line", e))
|
Timber.w(IllegalArgumentException("Unable to parse line: $line", e))
|
||||||
|
|||||||
@@ -50,8 +50,7 @@ fun NetworkInterface.formatAddresses() =
|
|||||||
.toList() +
|
.toList() +
|
||||||
listOfNotNull(try {
|
listOfNotNull(try {
|
||||||
hardwareAddress?.joinToString(":") { "%02x".format(it) }
|
hardwareAddress?.joinToString(":") { "%02x".format(it) }
|
||||||
} catch (e: SocketException) {
|
} catch (_: SocketException) {
|
||||||
Timber.w(e)
|
|
||||||
null
|
null
|
||||||
}))
|
}))
|
||||||
.joinToString("\n")
|
.joinToString("\n")
|
||||||
|
|||||||
Reference in New Issue
Block a user