Detekt: Use require() instead of throwing an IllegalArgumentException. [UseRequire]
This commit is contained in:
parent
b4f833cb0d
commit
40f8d94954
@ -76,7 +76,7 @@ object StringOrderUtils {
|
||||
}
|
||||
|
||||
fun stringToBase(x: String, alphabet: CharArray): BigInteger {
|
||||
if (x.isEmpty()) throw IllegalArgumentException()
|
||||
require(x.isNotEmpty())
|
||||
val len = alphabet.size.toBigInteger()
|
||||
var result = BigInteger("0")
|
||||
x.reversed().forEachIndexed { index, c ->
|
||||
|
@ -250,8 +250,10 @@ internal class MXMegolmEncryption(
|
||||
* @param sessionInfo the session info
|
||||
* @param devicesByUser the devices map
|
||||
*/
|
||||
private suspend fun shareUserDevicesKey(sessionInfo: MXOutboundSessionInfo,
|
||||
devicesByUser: Map<String, List<CryptoDeviceInfo>>) {
|
||||
private suspend fun shareUserDevicesKey(
|
||||
sessionInfo: MXOutboundSessionInfo,
|
||||
devicesByUser: Map<String, List<CryptoDeviceInfo>>
|
||||
) {
|
||||
val sessionKey = olmDevice.getSessionKey(sessionInfo.sessionId) ?: return Unit.also {
|
||||
Timber.tag(loggerTag.value).v("shareUserDevicesKey() Failed to share session, failed to export")
|
||||
}
|
||||
@ -533,7 +535,7 @@ internal class MXMegolmEncryption(
|
||||
|
||||
@Throws
|
||||
override suspend fun shareHistoryKeysWithDevice(inboundSessionWrapper: InboundGroupSessionHolder, deviceInfo: CryptoDeviceInfo) {
|
||||
if (!inboundSessionWrapper.wrapper.sessionData.sharedHistory) throw IllegalArgumentException("This key can't be shared")
|
||||
require(inboundSessionWrapper.wrapper.sessionData.sharedHistory) { "This key can't be shared" }
|
||||
Timber.tag(loggerTag.value).i("process shareHistoryKeys for ${inboundSessionWrapper.wrapper.safeSessionId} to ${deviceInfo.shortDebugString()}")
|
||||
val userId = deviceInfo.userId
|
||||
val deviceId = deviceInfo.deviceId
|
||||
|
Loading…
Reference in New Issue
Block a user