Fix bugs detected by Sonar

This commit is contained in:
Benoit Marty 2019-07-03 15:40:31 +02:00
parent e9eada77f9
commit 1ee1c31b9c
3 changed files with 20 additions and 28 deletions

View File

@ -181,10 +181,6 @@ public class MXUsersDevicesMap<E> implements Serializable {
@Override @Override
public String toString() { public String toString() {
if (null != mMap) {
return "MXUsersDevicesMap " + mMap.toString(); return "MXUsersDevicesMap " + mMap.toString();
} else {
return "MXDeviceInfo : null map";
}
} }
} }

View File

@ -16,9 +16,9 @@
package im.vector.matrix.android.internal.crypto.store.db.model package im.vector.matrix.android.internal.crypto.store.db.model
import io.realm.RealmObject
import im.vector.matrix.android.internal.crypto.IncomingRoomKeyRequest import im.vector.matrix.android.internal.crypto.IncomingRoomKeyRequest
import im.vector.matrix.android.internal.crypto.model.rest.RoomKeyRequestBody import im.vector.matrix.android.internal.crypto.model.rest.RoomKeyRequestBody
import io.realm.RealmObject
internal open class IncomingRoomKeyRequestEntity( internal open class IncomingRoomKeyRequestEntity(
var requestId: String? = null, var requestId: String? = null,
@ -32,11 +32,11 @@ internal open class IncomingRoomKeyRequestEntity(
) : RealmObject() { ) : RealmObject() {
fun toIncomingRoomKeyRequest(): IncomingRoomKeyRequest { fun toIncomingRoomKeyRequest(): IncomingRoomKeyRequest {
return IncomingRoomKeyRequest().apply { return IncomingRoomKeyRequest().also {
requestId = requestId it.requestId = requestId
userId = userId it.userId = userId
deviceId = deviceId it.deviceId = deviceId
requestBody = RoomKeyRequestBody().apply { it.requestBody = RoomKeyRequestBody().apply {
algorithm = requestBodyAlgorithm algorithm = requestBodyAlgorithm
roomId = requestBodyRoomId roomId = requestBodyRoomId
senderKey = requestBodySenderKey senderKey = requestBodySenderKey

View File

@ -63,6 +63,7 @@ class NotifiableEventResolver @Inject constructor(private val stringProvider: St
else -> { else -> {
//If the event can be displayed, display it as is //If the event can be displayed, display it as is
Timber.w("NotifiableEventResolver Received an unsupported event matching a bing rule")
//TODO Better event text display //TODO Better event text display
val bodyPreview = event.type val bodyPreview = event.type
@ -75,11 +76,6 @@ class NotifiableEventResolver @Inject constructor(private val stringProvider: St
title = stringProvider.getString(R.string.notification_unknown_new_event), title = stringProvider.getString(R.string.notification_unknown_new_event),
soundName = null, soundName = null,
type = event.type) type = event.type)
//Unsupported event
Timber.w("NotifiableEventResolver Received an unsupported event matching a bing rule")
return null
} }
} }
} }