<commit_before>package com.wingjay.jianshi.db;


import android.database.Cursor;
import android.util.Log;

import com.wingjay.jianshi.bean.Diary;

import java.util.UUID;

public class DBMigrationUtil {

  public static void migrateToDBFlow() {
    Log.i("Migrate", Thread.currentThread().getName());
    Cursor cursor = DbUtil.getAllDiary();
    if (cursor.getCount() == 0) {
      cursor.close();
      return;
    }
    if (cursor.moveToFirst()) {
      do {
        com.wingjay.jianshi.db.model.Diary diary = new com.wingjay.jianshi.db.model.Diary();
        diary.setTitle(cursor.getString(cursor.getColumnIndex(Diary.TITLE)));
        diary.setContent(cursor.getString(cursor.getColumnIndex(Diary.CONTENT)));
        diary.setTime_created(cursor.getLong(cursor.getColumnIndex(Diary.CREATED_TIME)));
        diary.setTime_modified(cursor.getLong(cursor.getColumnIndex(Diary.CREATED_TIME)));
        diary.setUuid(UUID.randomUUID().toString().toUpperCase());
        diary.save();
        Log.i("Migrate", "save success" + diary.getUuid());
      } while (cursor.moveToNext());
    }
    cursor.close();
  }
}<commit_msg>fix migration bug<commit_after>package com.wingjay.jianshi.db;


import android.database.Cursor;
import android.util.Log;

import com.wingjay.jianshi.bean.Diary;

import java.util.UUID;

public class DBMigrationUtil {

  public static void migrateToDBFlow() {
    Log.i("Migrate", Thread.currentThread().getName());
    Cursor cursor = DbUtil.getAllDiary();
    if (cursor.getCount() == 0) {
      cursor.close();
      return;
    }
    if (cursor.moveToFirst()) {
      do {
        com.wingjay.jianshi.db.model.Diary diary = new com.wingjay.jianshi.db.model.Diary();
        diary.setTitle(cursor.getString(cursor.getColumnIndex(Diary.TITLE)));
        diary.setContent(cursor.getString(cursor.getColumnIndex(Diary.CONTENT)));
        diary.setTime_created(cursor.getLong(cursor.getColumnIndex(Diary.CREATED_TIME)) * 1000);
        diary.setTime_modified(cursor.getLong(cursor.getColumnIndex(Diary.CREATED_TIME)) * 1000);
        diary.setUuid(UUID.randomUUID().toString().toUpperCase());
        diary.save();
        Log.i("Migrate", "save success" + diary.getUuid());
      } while (cursor.moveToNext());
    }
    cursor.close();
  }
}
{'fraction_non_alphanumeric': 0.147396293027361, 'fraction_numerical': 0.00441306266548985, 'mean_word_length': 3.6359918200409, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3751560', 'n_tokens_mistral': 763, 'n_tokens_neox': 751, 'n_words': 98}