Program: 171948
Project: 171948
Buggy source:
public void insertConversations(List<AVIMConversation> conversations){
  SQLiteDatabase db=dbHelper.getWritableDatabase();
  db.beginTransaction();
  for (  AVIMConversation conversation : conversations) {
    ContentValues values=new ContentValues();
    values.put(COLUMN_ATTRIBUTE,JSON.toJSONString(conversation.attributes));
    values.put(COLUMN_INSTANCEDATA,JSON.toJSONString(conversation.instanceData));
    values.put(COLUMN_CREATEDAT,conversation.createdAt);
    values.put(COLUMN_UPDATEDAT,conversation.updatedAt);
    values.put(COLUMN_CREATOR,conversation.creator);
    values.put(COLUMN_EXPIREAT,System.currentTimeMillis() + Conversation.DEFAULT_CONVERSATION_EXPIRE_TIME_IN_MILLS);
    if (conversation.lastMessageAt != null) {
      values.put(COLUMN_LM,conversation.lastMessageAt.getTime());
    }
    final AVIMMessage message=conversation.getLastMessage();
    if (null != message) {
      if (message instanceof AVIMBinaryMessage) {
        byte[] bytes=((AVIMBinaryMessage)message).getBytes();
        String base64Msg=AVUtils.Base64Encode(bytes);
        values.put(COLUMN_LASTMESSAGE,base64Msg);
        values.put(COLUMN_CONV_LASTMESSAGE_INNERTYPE,MESSAGE_INNERTYPE_BIN);
      }
 else {
        String lastMessage=JSON.toJSONString(message);
        values.put(COLUMN_LASTMESSAGE,lastMessage);
        values.put(COLUMN_CONV_LASTMESSAGE_INNERTYPE,MESSAGE_INNERTYPE_PLAIN);
      }
    }
    values.put(COLUMN_MEMBERS,JSON.toJSONString(conversation.getMembers()));
    values.put(COLUMN_TRANSIENT,conversation.isTransient ? 1 : 0);
    values.put(COLUMN_UNREAD_COUNT,conversation.getUnreadMessagesCount());
    values.put(COLUMN_CONV_MENTIONED,conversation.unreadMessagesMentioned() ? 1 : 0);
    values.put(COLUMN_CONVERSATION_READAT,conversation.getLastReadAt());
    values.put(COLUMN_CONVRESATION_DELIVEREDAT,conversation.getLastDeliveredAt());
    values.put(COLUMN_CONVERSATION_ID,conversation.getConversationId());
    db.insertWithOnConflict(CONVERSATION_TABLE,null,values,SQLiteDatabase.CONFLICT_REPLACE);
  }
  db.setTransactionSuccessful();
  db.endTransaction();
}

Fixed version (ground truth):
public void insertConversations(List<AVIMConversation> conversations){
  SQLiteDatabase db=dbHelper.getWritableDatabase();
  db.beginTransaction();
  for (  AVIMConversation conversation : conversations) {
    ContentValues values=new ContentValues();
    values.put(COLUMN_ATTRIBUTE,JSON.toJSONString(conversation.attributes));
    values.put(COLUMN_INSTANCEDATA,JSON.toJSONString(conversation.instanceData));
    values.put(COLUMN_CREATEDAT,conversation.createdAt);
    values.put(COLUMN_UPDATEDAT,conversation.updatedAt);
    values.put(COLUMN_CREATOR,conversation.creator);
    values.put(COLUMN_EXPIREAT,System.currentTimeMillis() + Conversation.DEFAULT_CONVERSATION_EXPIRE_TIME_IN_MILLS);
    if (conversation.lastMessageAt != null) {
      values.put(COLUMN_LM,conversation.lastMessageAt.getTime());
    }
    final AVIMMessage message=conversation.getLastMessage();
    if (null != message) {
      if (message instanceof AVIMBinaryMessage) {
        byte[] bytes=((AVIMBinaryMessage)message).getBytes();
        String base64Msg=AVUtils.base64Encode(bytes);
        values.put(COLUMN_LASTMESSAGE,base64Msg);
        values.put(COLUMN_CONV_LASTMESSAGE_INNERTYPE,MESSAGE_INNERTYPE_BIN);
      }
 else {
        String lastMessage=JSON.toJSONString(message);
        values.put(COLUMN_LASTMESSAGE,lastMessage);
        values.put(COLUMN_CONV_LASTMESSAGE_INNERTYPE,MESSAGE_INNERTYPE_PLAIN);
      }
    }
    values.put(COLUMN_MEMBERS,JSON.toJSONString(conversation.getMembers()));
    values.put(COLUMN_TRANSIENT,conversation.isTransient ? 1 : 0);
    values.put(COLUMN_UNREAD_COUNT,conversation.getUnreadMessagesCount());
    values.put(COLUMN_CONV_MENTIONED,conversation.unreadMessagesMentioned() ? 1 : 0);
    values.put(COLUMN_CONVERSATION_READAT,conversation.getLastReadAt());
    values.put(COLUMN_CONVRESATION_DELIVEREDAT,conversation.getLastDeliveredAt());
    values.put(COLUMN_CONVERSATION_ID,conversation.getConversationId());
    db.insertWithOnConflict(CONVERSATION_TABLE,null,values,SQLiteDatabase.CONFLICT_REPLACE);
  }
  db.setTransactionSuccessful();
  db.endTransaction();
}