Program: 93755
Project: 93755
Buggy source:
@SuppressLint("String_Node_Str") private List<Contacts> loadContacts(Context context){
  List<Contacts> kanjiStartContacts=new ArrayList<Contacts>();
  HashMap<String,Contacts> kanjiStartContactsHashMap=new HashMap<String,Contacts>();
  List<Contacts> nonKanjiStartContacts=new ArrayList<Contacts>();
  HashMap<String,Contacts> nonKanjiStartContactsHashMap=new HashMap<String,Contacts>();
  List<Contacts> contacts=new ArrayList<Contacts>();
  Contacts cs=null;
  Cursor cursor=null;
  String sortkey=null;
  long startLoadTime=System.currentTimeMillis();
  String[] projection=new String[]{ContactsContract.CommonDataKinds.Phone.CONTACT_ID,ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,ContactsContract.CommonDataKinds.Phone.NUMBER};
  try {
    cursor=context.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,projection,null,null,"String_Node_Str");
    int idColumnIndex=cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.CONTACT_ID);
    int dispalyNameColumnIndex=cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME);
    int numberColumnIndex=cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
    while (cursor.moveToNext()) {
      String id=cursor.getString(idColumnIndex);
      String displayName=cursor.getString(dispalyNameColumnIndex);
      String phoneNumber=cursor.getString(numberColumnIndex);
      boolean kanjiStartContactsExist=kanjiStartContactsHashMap.containsKey(id);
      boolean nonKanjiStartContactsExist=nonKanjiStartContactsHashMap.containsKey(id);
      if (true == kanjiStartContactsExist) {
        cs=kanjiStartContactsHashMap.get(id);
        cs.addPhoneNumber(phoneNumber);
      }
 else       if (true == nonKanjiStartContactsExist) {
        cs=nonKanjiStartContactsHashMap.get(id);
        cs.addPhoneNumber(phoneNumber);
      }
 else {
        cs=new Contacts(id,displayName,phoneNumber);
        PinyinUtil.chineseStringToPinyinUnit(cs.getName(),cs.getNamePinyinUnits());
        sortkey=PinyinUtil.getSortKey(cs.getNamePinyinUnits()).toUpperCase();
        cs.setSortKey(praseSortKey(sortkey));
        boolean isKanji=PinyinUtil.isKanji(cs.getName().charAt(0));
        if (true == isKanji) {
          kanjiStartContactsHashMap.put(id,cs);
        }
 else {
          nonKanjiStartContactsHashMap.put(id,cs);
        }
      }
    }
  }
 catch (  Exception e) {
  }
 finally {
    if (null != cursor) {
      cursor.close();
      cursor=null;
    }
  }
  kanjiStartContacts.addAll(kanjiStartContactsHashMap.values());
  Collections.sort(kanjiStartContacts,Contacts.mAscComparator);
  nonKanjiStartContacts.addAll(nonKanjiStartContactsHashMap.values());
  Collections.sort(nonKanjiStartContacts,Contacts.mAscComparator);
  contacts.addAll(kanjiStartContacts);
  int lastIndex=0;
  boolean shouldBeAdd=false;
  for (int i=0; i < nonKanjiStartContacts.size(); i++) {
    String nonKanfirstLetter=PinyinUtil.getFirstLetter(nonKanjiStartContacts.get(i).getNamePinyinUnits());
    int j=0;
    for (j=0 + lastIndex; j < contacts.size(); j++) {
      String firstLetter=PinyinUtil.getFirstLetter(contacts.get(j).getNamePinyinUnits());
      lastIndex++;
      if (firstLetter.charAt(0) > nonKanfirstLetter.charAt(0)) {
        shouldBeAdd=true;
        break;
      }
 else {
        shouldBeAdd=false;
      }
    }
    if (true == shouldBeAdd) {
      contacts.add(j,nonKanjiStartContacts.get(i));
      shouldBeAdd=false;
    }
  }
  long endLoadTime=System.currentTimeMillis();
  Log.i(TAG,"String_Node_Str" + (endLoadTime - startLoadTime) + "String_Node_Str");
  return contacts;
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") private List<Contacts> loadContacts(Context context){
  List<Contacts> kanjiStartContacts=new ArrayList<Contacts>();
  HashMap<String,Contacts> kanjiStartContactsHashMap=new HashMap<String,Contacts>();
  List<Contacts> nonKanjiStartContacts=new ArrayList<Contacts>();
  HashMap<String,Contacts> nonKanjiStartContactsHashMap=new HashMap<String,Contacts>();
  List<Contacts> contacts=new ArrayList<Contacts>();
  Contacts cs=null;
  Cursor cursor=null;
  String sortkey=null;
  long startLoadTime=System.currentTimeMillis();
  String[] projection=new String[]{ContactsContract.CommonDataKinds.Phone.CONTACT_ID,ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,ContactsContract.CommonDataKinds.Phone.NUMBER};
  try {
    cursor=context.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,projection,null,null,"String_Node_Str");
    int idColumnIndex=cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.CONTACT_ID);
    int dispalyNameColumnIndex=cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME);
    int numberColumnIndex=cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
    while (cursor.moveToNext()) {
      String id=cursor.getString(idColumnIndex);
      String displayName=cursor.getString(dispalyNameColumnIndex);
      String phoneNumber=cursor.getString(numberColumnIndex);
      boolean kanjiStartContactsExist=kanjiStartContactsHashMap.containsKey(id);
      boolean nonKanjiStartContactsExist=nonKanjiStartContactsHashMap.containsKey(id);
      if (true == kanjiStartContactsExist) {
        cs=kanjiStartContactsHashMap.get(id);
        cs.addPhoneNumber(phoneNumber);
      }
 else       if (true == nonKanjiStartContactsExist) {
        cs=nonKanjiStartContactsHashMap.get(id);
        cs.addPhoneNumber(phoneNumber);
      }
 else {
        cs=new Contacts(id,displayName,phoneNumber);
        PinyinUtil.chineseStringToPinyinUnit(cs.getName(),cs.getNamePinyinUnits());
        sortkey=PinyinUtil.getSortKey(cs.getNamePinyinUnits()).toUpperCase();
        cs.setSortKey(praseSortKey(sortkey));
        boolean isKanji=PinyinUtil.isKanji(cs.getName().charAt(0));
        if (true == isKanji) {
          kanjiStartContactsHashMap.put(id,cs);
        }
 else {
          nonKanjiStartContactsHashMap.put(id,cs);
        }
      }
    }
  }
 catch (  Exception e) {
  }
 finally {
    if (null != cursor) {
      cursor.close();
      cursor=null;
    }
  }
  kanjiStartContacts.addAll(kanjiStartContactsHashMap.values());
  Collections.sort(kanjiStartContacts,Contacts.mAscComparator);
  nonKanjiStartContacts.addAll(nonKanjiStartContactsHashMap.values());
  Collections.sort(nonKanjiStartContacts,Contacts.mAscComparator);
  contacts.addAll(kanjiStartContacts);
  int lastIndex=0;
  boolean shouldBeAdd=false;
  for (int i=0; i < nonKanjiStartContacts.size(); i++) {
    String nonKanfirstLetter=PinyinUtil.getFirstLetter(nonKanjiStartContacts.get(i).getNamePinyinUnits());
    int j=0;
    for (j=0 + lastIndex; j < contacts.size(); j++) {
      String firstLetter=PinyinUtil.getFirstLetter(contacts.get(j).getNamePinyinUnits());
      lastIndex++;
      if (firstLetter.charAt(0) > nonKanfirstLetter.charAt(0)) {
        shouldBeAdd=true;
        break;
      }
 else {
        shouldBeAdd=false;
      }
    }
    if (lastIndex >= contacts.size()) {
      lastIndex++;
      shouldBeAdd=true;
    }
    if (true == shouldBeAdd) {
      contacts.add(j,nonKanjiStartContacts.get(i));
      shouldBeAdd=false;
    }
  }
  long endLoadTime=System.currentTimeMillis();
  Log.i(TAG,"String_Node_Str" + (endLoadTime - startLoadTime) + "String_Node_Str"+ contacts.size());
  return contacts;
}