Change summary
src/main/java/eu/siacs/conversations/entities/Message.java | 2
src/main/java/eu/siacs/conversations/entities/Reaction.java | 6
src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java | 4
3 files changed, 8 insertions(+), 4 deletions(-)
Detailed changes
@@ -227,7 +227,7 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable
this.reactions = reactions;
}
- public static Message fromCursor(Cursor cursor, Conversation conversation) {
+ public static Message fromCursor(final Cursor cursor, final Conversation conversation) {
return new Message(conversation,
cursor.getString(cursor.getColumnIndexOrThrow(UUID)),
cursor.getString(cursor.getColumnIndexOrThrow(CONVERSATION)),
@@ -1,5 +1,7 @@
package eu.siacs.conversations.entities;
+import android.util.Log;
+
import androidx.annotation.NonNull;
import com.google.common.base.MoreObjects;
@@ -19,6 +21,7 @@ import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
+import eu.siacs.conversations.Config;
import eu.siacs.conversations.xmpp.Jid;
import java.io.IOException;
@@ -76,8 +79,9 @@ public class Reaction {
return Collections.emptyList();
}
try {
- return GSON.fromJson(asString, new TypeToken<ArrayList<Reaction>>() {}.getType());
+ return GSON.fromJson(asString, new TypeToken<List<Reaction>>() {}.getType());
} catch (final JsonSyntaxException e) {
+ Log.e(Config.LOGTAG,"could not restore reactions", e);
return Collections.emptyList();
}
}
@@ -820,8 +820,8 @@ public class DatabaseBackend extends SQLiteOpenHelper {
while (cursor.moveToNext()) {
try {
list.add(0, Message.fromCursor(cursor, conversation));
- } catch (Exception e) {
- Log.e(Config.LOGTAG, "unable to restore message");
+ } catch (final Exception e) {
+ Log.e(Config.LOGTAG, "unable to restore message", e);
}
}
cursor.close();