nus-yam/ex-repair huggingface dataset:
Program: 63501
Project: 63501
Buggy source:
/** 
 * Queries the sublayer's feature table with the query parameters and displays the result features as graphics
 * @param sublayer        - type of sublayer to query from
 * @param sublayerSymbol  - symbol to display on map
 * @param query           - filters based on the population and the current view point
 * @param graphicsOverlay - manages the graphics that will be added to the map view
 */
private void QueryAndDisplayGraphics(ArcGISMapImageSublayer sublayer,Symbol sublayerSymbol,QueryParameters query,GraphicsOverlay graphicsOverlay){
  if (sublayer.getLoadStatus() == LoadStatus.LOADED) {
    ServiceFeatureTable sublayerTable=sublayer.getTable();
    ListenableFuture<FeatureQueryResult> sublayerQuery=sublayerTable.queryFeaturesAsync(query);
    sublayerQuery.addDoneListener(() -> {
      try {
        FeatureQueryResult result=sublayerQuery.get();
        for (        Feature feature : result) {
          Graphic sublayerGraphic=new Graphic(feature.getGeometry(),sublayerSymbol);
          graphicsOverlay.getGraphics().add(sublayerGraphic);
        }
      }
 catch (      InterruptedException|ExecutionException e) {
        Toast.makeText(MainActivity.this,e.toString(),Toast.LENGTH_SHORT).show();
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * Queries the sublayer's feature table with the query parameters and displays the result features as graphics
 * @param sublayer        - type of sublayer to query from
 * @param sublayerSymbol  - symbol to display on map
 * @param query           - filters based on the population and the current view point
 * @param graphicsOverlay - manages the graphics that will be added to the map view
 */
private static void QueryAndDisplayGraphics(ArcGISMapImageSublayer sublayer,Symbol sublayerSymbol,QueryParameters query,GraphicsOverlay graphicsOverlay){
  if (sublayer.getLoadStatus() == LoadStatus.LOADED) {
    ServiceFeatureTable sublayerTable=sublayer.getTable();
    ListenableFuture<FeatureQueryResult> sublayerQuery=sublayerTable.queryFeaturesAsync(query);
    sublayerQuery.addDoneListener(() -> {
      try {
        FeatureQueryResult result=sublayerQuery.get();
        for (        Feature feature : result) {
          Graphic sublayerGraphic=new Graphic(feature.getGeometry(),sublayerSymbol);
          graphicsOverlay.getGraphics().add(sublayerGraphic);
        }
      }
 catch (      InterruptedException|ExecutionException e) {
        Log.e(MainActivity.class.getSimpleName(),e.toString());
      }
    }
);
  }
}
Program: 63505
Project: 63505
Buggy source:
private void removeSingleTx(SQLiteDatabase db,String tx){
  String deleteTx="String_Node_Str" + tx + "String_Node_Str";
  String deleteIn="String_Node_Str" + tx + "String_Node_Str";
  String deleteOut="String_Node_Str" + tx + "String_Node_Str";
  String deleteAddressesTx="String_Node_Str" + tx + "String_Node_Str";
  String inSql="String_Node_Str" + tx + "String_Node_Str";
  String existOtherIn="String_Node_Str";
  String updatePrevOut="String_Node_Str";
  Cursor c=db.rawQuery(inSql,new String[]{tx});
  List<Object[]> needUpdateOuts=new ArrayList<Object[]>();
  while (c.moveToNext()) {
    int idColumn=c.getColumnIndex(AbstractDb.InsColumns.PREV_TX_HASH);
    String prevTxHash=null;
    int prevOutSn=0;
    if (idColumn != -1) {
      prevTxHash=c.getString(idColumn);
    }
    idColumn=c.getColumnIndex(AbstractDb.InsColumns.PREV_OUT_SN);
    if (idColumn != -1) {
      prevOutSn=c.getInt(idColumn);
    }
    needUpdateOuts.add(new Object[]{prevTxHash,prevOutSn});
  }
  c.close();
  db.execSQL(deleteAddressesTx);
  db.execSQL(deleteOut);
  db.execSQL(deleteIn);
  db.execSQL(deleteTx);
  for (  Object[] array : needUpdateOuts) {
    c=db.rawQuery(existOtherIn,new String[]{array[0].toString(),array[1].toString()});
    while (c.moveToNext()) {
      if (c.getInt(0) == 0) {
        String updateSql=Utils.format(updatePrevOut,Out.OutStatus.unspent.getValue(),array[0].toString(),Integer.valueOf(array[1].toString()));
        db.execSQL(updateSql);
      }
    }
    c.close();
  }
}

Fixed version (ground truth):
private void removeSingleTx(SQLiteDatabase db,String tx){
  String deleteTx="String_Node_Str" + tx + "String_Node_Str";
  String deleteIn="String_Node_Str" + tx + "String_Node_Str";
  String deleteOut="String_Node_Str" + tx + "String_Node_Str";
  String deleteAddressesTx="String_Node_Str" + tx + "String_Node_Str";
  String inSql="String_Node_Str" + tx + "String_Node_Str";
  String existOtherIn="String_Node_Str";
  String updatePrevOut="String_Node_Str";
  Cursor c=db.rawQuery(inSql,null);
  List<Object[]> needUpdateOuts=new ArrayList<Object[]>();
  while (c.moveToNext()) {
    int idColumn=c.getColumnIndex(AbstractDb.InsColumns.PREV_TX_HASH);
    String prevTxHash=null;
    int prevOutSn=0;
    if (idColumn != -1) {
      prevTxHash=c.getString(idColumn);
    }
    idColumn=c.getColumnIndex(AbstractDb.InsColumns.PREV_OUT_SN);
    if (idColumn != -1) {
      prevOutSn=c.getInt(idColumn);
    }
    needUpdateOuts.add(new Object[]{prevTxHash,prevOutSn});
  }
  c.close();
  db.execSQL(deleteAddressesTx);
  db.execSQL(deleteOut);
  db.execSQL(deleteIn);
  db.execSQL(deleteTx);
  for (  Object[] array : needUpdateOuts) {
    c=db.rawQuery(existOtherIn,new String[]{array[0].toString(),array[1].toString()});
    while (c.moveToNext()) {
      if (c.getInt(0) == 0) {
        String updateSql=Utils.format(updatePrevOut,Out.OutStatus.unspent.getValue(),array[0].toString(),Integer.valueOf(array[1].toString()));
        db.execSQL(updateSql);
      }
    }
    c.close();
  }
}
Program: 63506
Project: 63506
Buggy source:
@Override public int addMonitoredHDAccount(boolean isXrandom,byte[] externalPub,byte[] internalPub){
  SQLiteDatabase db=this.mDb.getWritableDatabase();
  db.beginTransaction();
  ContentValues cv=new ContentValues();
  cv.put(AbstractDb.HDAccountColumns.IS_XRANDOM,isXrandom ? 1 : 0);
  cv.put(AbstractDb.HDAccountColumns.EXTERNAL_PUB,Base58.encode(externalPub));
  cv.put(AbstractDb.HDAccountColumns.INTERNAL_PUB,Base58.encode(internalPub));
  int seedId=(int)db.insert(AbstractDb.Tables.HD_ACCOUNT,null,cv);
  db.setTransactionSuccessful();
  db.endTransaction();
  return seedId;
}

Fixed version (ground truth):
@Override public int addMonitoredHDAccount(String firstAddress,boolean isXrandom,byte[] externalPub,byte[] internalPub){
  SQLiteDatabase db=this.mDb.getWritableDatabase();
  db.beginTransaction();
  ContentValues cv=new ContentValues();
  cv.put(AbstractDb.HDAccountColumns.HD_ADDRESS,firstAddress);
  cv.put(AbstractDb.HDAccountColumns.IS_XRANDOM,isXrandom ? 1 : 0);
  cv.put(AbstractDb.HDAccountColumns.EXTERNAL_PUB,Base58.encode(externalPub));
  cv.put(AbstractDb.HDAccountColumns.INTERNAL_PUB,Base58.encode(internalPub));
  int seedId=(int)db.insert(AbstractDb.Tables.HD_ACCOUNT,null,cv);
  db.setTransactionSuccessful();
  db.endTransaction();
  return seedId;
}
Program: 63507
Project: 63507
Buggy source:
public void check(){
  if ((AddressManager.getInstance().getPrivKeyAddresses() == null || AddressManager.getInstance().getPrivKeyAddresses().size() == 0) && !AddressManager.getInstance().hasHDMKeychain() && (AppSharedPreference.getInstance().getAppMode() == BitherjSettings.AppMode.HOT || !AddressManager.getInstance().hasHDAccountCold())) {
    DropdownMessage.showDropdownMessage((Activity)getContext(),R.string.private_key_is_empty);
    return;
  }
  DialogPassword dialog=new DialogPassword(getContext(),CheckHeaderView.this);
  dialog.show();
}

Fixed version (ground truth):
public void check(){
  if ((AddressManager.getInstance().getPrivKeyAddresses() == null || AddressManager.getInstance().getPrivKeyAddresses().size() == 0) && !AddressManager.getInstance().hasHDMKeychain() && !(AppSharedPreference.getInstance().getAppMode() == BitherjSettings.AppMode.COLD && AddressManager.getInstance().hasHDAccountCold())&& !(AppSharedPreference.getInstance().getAppMode() == BitherjSettings.AppMode.HOT && AddressManager.getInstance().hasHDAccountHot())) {
    DropdownMessage.showDropdownMessage((Activity)getContext(),R.string.private_key_is_empty);
    return;
  }
  DialogPassword dialog=new DialogPassword(getContext(),CheckHeaderView.this);
  dialog.show();
}
Program: 63508
Project: 63508
Buggy source:
public static void setHDAccount(HDAccount hdAccount){
  AddressManager.getInstance().setHdAccountHot(hdAccount);
  if (AppSharedPreference.getInstance().getAppMode() == BitherjSettings.AppMode.COLD) {
    BackupUtil.backupColdKey(false);
  }
 else {
    BackupUtil.backupHotKey();
  }
}

Fixed version (ground truth):
public static void setHDAccount(HDAccount hdAccount){
  if (AppSharedPreference.getInstance().getAppMode() == BitherjSettings.AppMode.COLD) {
    BackupUtil.backupColdKey(false);
  }
 else {
    AddressManager.getInstance().setHdAccountHot(hdAccount);
    BackupUtil.backupHotKey();
  }
}
Program: 63509
Project: 63509
Buggy source:
private void v2Tov3(SQLiteDatabase db){
  Cursor c=db.rawQuery("String_Node_Str",null);
  int cnt=0;
  if (c.moveToNext()) {
    cnt=c.getInt(0);
  }
  c.close();
  db.execSQL("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  if (cnt > 0) {
    db.execSQL("String_Node_Str");
    int hd_account_id=-1;
    c=BitherApplication.mAddressDbHelper.getReadableDatabase().rawQuery("String_Node_Str",null);
    if (c.moveToNext()) {
      hd_account_id=c.getInt(0);
      if (c.moveToNext()) {
        c.close();
        throw new RuntimeException("String_Node_Str");
      }
 else {
        c.close();
      }
    }
 else {
      c.close();
      throw new RuntimeException("String_Node_Str");
    }
    db.execSQL("String_Node_Str" + String.valueOf(hd_account_id));
    db.execSQL("String_Node_Str");
  }
  int oldCnt=0;
  int newCnt=0;
  c=db.rawQuery("String_Node_Str",null);
  if (c.moveToNext()) {
    oldCnt=c.getInt(0);
  }
  c.close();
  c=db.rawQuery("String_Node_Str",null);
  if (c.moveToNext()) {
    newCnt=c.getInt(0);
  }
  c.close();
  if (oldCnt != newCnt) {
    throw new RuntimeException("String_Node_Str");
  }
 else {
    db.execSQL("String_Node_Str");
    db.execSQL("String_Node_Str");
  }
  db.execSQL(AbstractDb.CREATE_OUT_HD_ACCOUNT_ID_INDEX);
  db.execSQL(AbstractDb.CREATE_HD_ACCOUNT_ACCOUNT_ID_AND_PATH_TYPE_INDEX);
}

Fixed version (ground truth):
private void v2Tov3(SQLiteDatabase db){
  Cursor c=db.rawQuery("String_Node_Str",null);
  int cnt=0;
  if (c.moveToNext()) {
    cnt=c.getInt(0);
  }
  c.close();
  db.execSQL("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  if (cnt > 0) {
    db.execSQL("String_Node_Str");
    int hd_account_id=-1;
    c=BitherApplication.mAddressDbHelper.getReadableDatabase().rawQuery("String_Node_Str",null);
    if (c.moveToNext()) {
      hd_account_id=c.getInt(0);
      if (c.moveToNext()) {
        c.close();
        throw new RuntimeException("String_Node_Str");
      }
 else {
        c.close();
      }
    }
 else {
      c.close();
      throw new RuntimeException("String_Node_Str");
    }
    db.execSQL("String_Node_Str",new String[]{Integer.toString(hd_account_id)});
    db.execSQL("String_Node_Str" + "String_Node_Str");
  }
  int oldCnt=0;
  int newCnt=0;
  c=db.rawQuery("String_Node_Str",null);
  if (c.moveToNext()) {
    oldCnt=c.getInt(0);
  }
  c.close();
  c=db.rawQuery("String_Node_Str",null);
  if (c.moveToNext()) {
    newCnt=c.getInt(0);
  }
  c.close();
  if (oldCnt != newCnt) {
    throw new RuntimeException("String_Node_Str");
  }
 else {
    db.execSQL("String_Node_Str");
    db.execSQL("String_Node_Str");
  }
  db.execSQL(AbstractDb.CREATE_OUT_HD_ACCOUNT_ID_INDEX);
  db.execSQL(AbstractDb.CREATE_HD_ACCOUNT_ACCOUNT_ID_AND_PATH_TYPE_INDEX);
}
Program: 63510
Project: 63510
Buggy source:
private void v2Tov3(SQLiteDatabase db){
  Cursor c=db.rawQuery("String_Node_Str",null);
  int cnt=0;
  if (c.moveToNext()) {
    cnt=c.getInt(0);
  }
  c.close();
  if (cnt > 0) {
    db.execSQL("String_Node_Str");
    int hd_account_id=-1;
    c=BitherApplication.mAddressDbHelper.getReadableDatabase().rawQuery("String_Node_Str",null);
    if (c.moveToNext()) {
      hd_account_id=c.getInt(0);
      if (c.moveToNext()) {
        c.close();
        throw new RuntimeException("String_Node_Str");
      }
 else {
        c.close();
      }
    }
 else {
      c.close();
      throw new RuntimeException("String_Node_Str");
    }
    db.execSQL("String_Node_Str" + String.valueOf(hd_account_id));
  }
  db.execSQL("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  db.execSQL("String_Node_Str");
  int oldCnt=0;
  int newCnt=0;
  c=db.rawQuery("String_Node_Str",null);
  if (c.moveToNext()) {
    oldCnt=c.getInt(0);
  }
  c.close();
  c=db.rawQuery("String_Node_Str",null);
  if (c.moveToNext()) {
    newCnt=c.getInt(0);
  }
  c.close();
  if (oldCnt != newCnt) {
    throw new RuntimeException("String_Node_Str");
  }
 else {
    db.execSQL("String_Node_Str");
    db.execSQL("String_Node_Str");
  }
  db.execSQL(AbstractDb.CREATE_OUT_HD_ACCOUNT_ID_INDEX);
  db.execSQL(AbstractDb.CREATE_HD_ACCOUNT_ACCOUNT_ID_AND_PATH_TYPE_INDEX);
}

Fixed version (ground truth):
private void v2Tov3(SQLiteDatabase db){
  Cursor c=db.rawQuery("String_Node_Str",null);
  int cnt=0;
  if (c.moveToNext()) {
    cnt=c.getInt(0);
  }
  c.close();
  db.execSQL("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  if (cnt > 0) {
    db.execSQL("String_Node_Str");
    int hd_account_id=-1;
    c=BitherApplication.mAddressDbHelper.getReadableDatabase().rawQuery("String_Node_Str",null);
    if (c.moveToNext()) {
      hd_account_id=c.getInt(0);
      if (c.moveToNext()) {
        c.close();
        throw new RuntimeException("String_Node_Str");
      }
 else {
        c.close();
      }
    }
 else {
      c.close();
      throw new RuntimeException("String_Node_Str");
    }
    db.execSQL("String_Node_Str" + String.valueOf(hd_account_id));
    db.execSQL("String_Node_Str");
  }
  int oldCnt=0;
  int newCnt=0;
  c=db.rawQuery("String_Node_Str",null);
  if (c.moveToNext()) {
    oldCnt=c.getInt(0);
  }
  c.close();
  c=db.rawQuery("String_Node_Str",null);
  if (c.moveToNext()) {
    newCnt=c.getInt(0);
  }
  c.close();
  if (oldCnt != newCnt) {
    throw new RuntimeException("String_Node_Str");
  }
 else {
    db.execSQL("String_Node_Str");
    db.execSQL("String_Node_Str");
  }
  db.execSQL(AbstractDb.CREATE_OUT_HD_ACCOUNT_ID_INDEX);
  db.execSQL(AbstractDb.CREATE_HD_ACCOUNT_ACCOUNT_ID_AND_PATH_TYPE_INDEX);
}
Program: 63511
Project: 63511
Buggy source:
private void v2Tov3(SQLiteDatabase db){
  Cursor c=db.rawQuery("String_Node_Str",null);
  int cnt=0;
  if (c.moveToNext()) {
    cnt=c.getInt(0);
  }
  c.close();
  if (cnt == 0) {
    db.execSQL("String_Node_Str");
  }
 else {
    db.execSQL("String_Node_Str");
    int hd_account_id=-1;
    c=BitherApplication.mAddressDbHelper.getReadableDatabase().rawQuery("String_Node_Str",null);
    if (c.moveToNext()) {
      hd_account_id=c.getInt(0);
      if (c.moveToNext()) {
        c.close();
        throw new RuntimeException("String_Node_Str");
      }
 else {
        c.close();
      }
    }
 else {
      c.close();
      throw new RuntimeException("String_Node_Str");
    }
    db.execSQL("String_Node_Str" + String.valueOf(hd_account_id));
    db.execSQL("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    db.execSQL("String_Node_Str");
    int oldCnt=0;
    int newCnt=0;
    c=db.rawQuery("String_Node_Str",null);
    if (c.moveToNext()) {
      oldCnt=c.getInt(0);
    }
    c.close();
    c=db.rawQuery("String_Node_Str",null);
    if (c.moveToNext()) {
      newCnt=c.getInt(0);
    }
    c.close();
    if (oldCnt != newCnt) {
      throw new RuntimeException("String_Node_Str");
    }
 else {
      db.execSQL("String_Node_Str");
      db.execSQL("String_Node_Str");
    }
  }
  db.execSQL(AbstractDb.CREATE_OUT_HD_ACCOUNT_ID_INDEX);
  db.execSQL(AbstractDb.CREATE_HD_ACCOUNT_ACCOUNT_ID_AND_PATH_TYPE_INDEX);
}

Fixed version (ground truth):
private void v2Tov3(SQLiteDatabase db){
  Cursor c=db.rawQuery("String_Node_Str",null);
  int cnt=0;
  if (c.moveToNext()) {
    cnt=c.getInt(0);
  }
  c.close();
  if (cnt > 0) {
    db.execSQL("String_Node_Str");
    int hd_account_id=-1;
    c=BitherApplication.mAddressDbHelper.getReadableDatabase().rawQuery("String_Node_Str",null);
    if (c.moveToNext()) {
      hd_account_id=c.getInt(0);
      if (c.moveToNext()) {
        c.close();
        throw new RuntimeException("String_Node_Str");
      }
 else {
        c.close();
      }
    }
 else {
      c.close();
      throw new RuntimeException("String_Node_Str");
    }
    db.execSQL("String_Node_Str" + String.valueOf(hd_account_id));
  }
  db.execSQL("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  db.execSQL("String_Node_Str");
  int oldCnt=0;
  int newCnt=0;
  c=db.rawQuery("String_Node_Str",null);
  if (c.moveToNext()) {
    oldCnt=c.getInt(0);
  }
  c.close();
  c=db.rawQuery("String_Node_Str",null);
  if (c.moveToNext()) {
    newCnt=c.getInt(0);
  }
  c.close();
  if (oldCnt != newCnt) {
    throw new RuntimeException("String_Node_Str");
  }
 else {
    db.execSQL("String_Node_Str");
    db.execSQL("String_Node_Str");
  }
  db.execSQL(AbstractDb.CREATE_OUT_HD_ACCOUNT_ID_INDEX);
  db.execSQL(AbstractDb.CREATE_HD_ACCOUNT_ACCOUNT_ID_AND_PATH_TYPE_INDEX);
}
Program: 63512
Project: 63512
Buggy source:
@Override public Tx updateOutHDAccountId(Tx tx){
  List<String> addressList=tx.getOutAddressList();
  if (addressList != null) {
    HashSet<String> set=new HashSet<String>();
    set.addAll(addressList);
    StringBuilder strBuilder=new StringBuilder();
    for (    String str : set) {
      strBuilder.append("String_Node_Str").append(str).append("String_Node_Str");
    }
    if (strBuilder.length() > 0) {
      strBuilder.substring(0,strBuilder.length() - 1);
    }
    SQLiteDatabase db=this.mDb.getReadableDatabase();
    String sql=Utils.format("String_Node_Str",strBuilder.toString());
    Cursor c=db.rawQuery(sql,null);
    while (c.moveToNext()) {
      String address=c.getString(0);
      int hdAccountId=c.getInt(1);
      for (      Out out : tx.getOuts()) {
        if (Utils.compareString(out.getOutAddress(),address)) {
          out.setHDAccountId(hdAccountId);
        }
      }
    }
    c.close();
  }
  return tx;
}

Fixed version (ground truth):
@Override public Tx updateOutHDAccountId(Tx tx){
  List<String> addressList=tx.getOutAddressList();
  if (addressList != null && addressList.size() > 0) {
    HashSet<String> set=new HashSet<String>();
    set.addAll(addressList);
    StringBuilder strBuilder=new StringBuilder();
    for (    String str : set) {
      strBuilder.append("String_Node_Str").append(str).append("String_Node_Str");
    }
    SQLiteDatabase db=this.mDb.getReadableDatabase();
    String sql=Utils.format("String_Node_Str",strBuilder.substring(0,strBuilder.length() - 1));
    Cursor c=db.rawQuery(sql,null);
    while (c.moveToNext()) {
      String address=c.getString(0);
      int hdAccountId=c.getInt(1);
      for (      Out out : tx.getOuts()) {
        if (Utils.compareString(out.getOutAddress(),address)) {
          out.setHDAccountId(hdAccountId);
        }
      }
    }
    c.close();
  }
  return tx;
}
Program: 63513
Project: 63513
Buggy source:
@Override public List<Integer> getRelatedHDAccountIdList(List<String> addresses){
  List<Integer> hdAccountIdList=new ArrayList<Integer>();
  if (addresses != null) {
    HashSet<String> set=new HashSet<String>();
    set.addAll(addresses);
    StringBuilder strBuilder=new StringBuilder();
    for (    String str : set) {
      strBuilder.append("String_Node_Str").append(str).append("String_Node_Str");
    }
    if (strBuilder.length() > 0) {
      strBuilder.substring(0,strBuilder.length() - 1);
    }
    SQLiteDatabase db=this.mDb.getReadableDatabase();
    String sql=Utils.format("String_Node_Str",strBuilder.toString());
    Cursor c=db.rawQuery(sql,null);
    while (c.moveToNext()) {
      hdAccountIdList.add(c.getInt(0));
    }
    c.close();
  }
  return hdAccountIdList;
}

Fixed version (ground truth):
@Override public List<Integer> getRelatedHDAccountIdList(List<String> addresses){
  List<Integer> hdAccountIdList=new ArrayList<Integer>();
  if (addresses != null && addresses.size() > 0) {
    HashSet<String> set=new HashSet<String>();
    set.addAll(addresses);
    StringBuilder strBuilder=new StringBuilder();
    for (    String str : set) {
      strBuilder.append("String_Node_Str").append(str).append("String_Node_Str");
    }
    SQLiteDatabase db=this.mDb.getReadableDatabase();
    String sql=Utils.format("String_Node_Str",strBuilder.substring(0,strBuilder.length() - 1));
    Cursor c=db.rawQuery(sql,null);
    while (c.moveToNext()) {
      hdAccountIdList.add(c.getInt(0));
    }
    c.close();
  }
  return hdAccountIdList;
}
Program: 63514
Project: 63514
Buggy source:
@Override public int getRelatedAddressCnt(List<String> addresses){
  int cnt=0;
  if (addresses != null) {
    HashSet<String> set=new HashSet<String>();
    set.addAll(addresses);
    StringBuilder strBuilder=new StringBuilder();
    for (    String str : set) {
      strBuilder.append("String_Node_Str").append(str).append("String_Node_Str");
    }
    if (strBuilder.length() > 0) {
      strBuilder.substring(0,strBuilder.length() - 1);
    }
    SQLiteDatabase db=this.mDb.getReadableDatabase();
    String sql=Utils.format("String_Node_Str",strBuilder.toString());
    Cursor c=db.rawQuery(sql,null);
    if (c.moveToNext()) {
      cnt=c.getInt(0);
    }
    c.close();
  }
  return cnt;
}

Fixed version (ground truth):
@Override public int getRelatedAddressCnt(List<String> addresses){
  int cnt=0;
  if (addresses != null && addresses.size() > 0) {
    HashSet<String> set=new HashSet<String>();
    set.addAll(addresses);
    StringBuilder strBuilder=new StringBuilder();
    for (    String str : set) {
      strBuilder.append("String_Node_Str").append(str).append("String_Node_Str");
    }
    SQLiteDatabase db=this.mDb.getReadableDatabase();
    String sql=Utils.format("String_Node_Str",strBuilder.substring(0,strBuilder.length() - 1));
    Cursor c=db.rawQuery(sql,null);
    if (c.moveToNext()) {
      cnt=c.getInt(0);
    }
    c.close();
  }
  return cnt;
}
Program: 63515
Project: 63515
Buggy source:
@Override public void runWithService(BlockchainService service){
  service.stopAndUnregister();
  for (  Address address : AddressManager.getInstance().getAllAddresses()) {
    address.setSyncComplete(false);
    address.updateSyncComplete();
  }
  HDAccountProvider.getInstance().setSyncdNotComplete();
  TxProvider.getInstance().clearAllTx();
  for (  Address address : AddressManager.getInstance().getAllAddresses()) {
    address.notificatTx(null,Tx.TxNotificationType.txFromApi);
  }
  try {
    if (!AddressManager.getInstance().addressIsSyncComplete()) {
      TransactionsUtil.getMyTxFromBither();
    }
    service.startAndRegister();
    HotAdvanceActivity.this.runOnUiThread(new Runnable(){
      @Override public void run(){
        dp.dismiss();
        DropdownMessage.showDropdownMessage(HotAdvanceActivity.this,R.string.reload_tx_success);
      }
    }
);
  }
 catch (  Exception e) {
    e.printStackTrace();
    HotAdvanceActivity.this.runOnUiThread(new Runnable(){
      @Override public void run(){
        dp.dismiss();
        DropdownMessage.showDropdownMessage(HotAdvanceActivity.this,R.string.network_or_connection_error);
      }
    }
);
  }
}

Fixed version (ground truth):
@Override public void runWithService(BlockchainService service){
  service.stopAndUnregister();
  for (  Address address : AddressManager.getInstance().getAllAddresses()) {
    address.setSyncComplete(false);
    address.updateSyncComplete();
  }
  HDAccountProvider.getInstance().setSyncdNotComplete();
  ColdHDAccountProvider.getInstance().setSyncdNotComplete();
  TxProvider.getInstance().clearAllTx();
  for (  Address address : AddressManager.getInstance().getAllAddresses()) {
    address.notificatTx(null,Tx.TxNotificationType.txFromApi);
  }
  try {
    if (!AddressManager.getInstance().addressIsSyncComplete()) {
      TransactionsUtil.getMyTxFromBither();
    }
    service.startAndRegister();
    HotAdvanceActivity.this.runOnUiThread(new Runnable(){
      @Override public void run(){
        dp.dismiss();
        DropdownMessage.showDropdownMessage(HotAdvanceActivity.this,R.string.reload_tx_success);
      }
    }
);
  }
 catch (  Exception e) {
    e.printStackTrace();
    HotAdvanceActivity.this.runOnUiThread(new Runnable(){
      @Override public void run(){
        dp.dismiss();
        DropdownMessage.showDropdownMessage(HotAdvanceActivity.this,R.string.network_or_connection_error);
      }
    }
);
  }
}
Program: 63518
Project: 63518
Buggy source:
@Override public void onCreate(){
  new LinuxSecureRandom();
  super.onCreate();
  mContext=getApplicationContext();
  mDbHelper=new BitherDatabaseHelper(mContext);
  mAddressDbHelper=new AddressDatabaseHelper(mContext);
  mHDDbHelper=new HDAccountDatabaseHelper(mContext);
  AndroidDbImpl androidDb=new AndroidDbImpl();
  androidDb.construct();
  AndroidImplAbstractApp appAndroid=new AndroidImplAbstractApp();
  appAndroid.construct();
  AbstractApp.notificationService.removeAddressLoadCompleteState();
  StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().permitDiskReads().permitDiskWrites().penaltyLog().build());
  Threading.throwOnLockCycles();
  initApp();
  mBitherApplication=this;
  ueHandler=new UEHandler();
  Thread.setDefaultUncaughtExceptionHandler(ueHandler);
  activityManager=(ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
}

Fixed version (ground truth):
@Override public void onCreate(){
  new LinuxSecureRandom();
  super.onCreate();
  mContext=getApplicationContext();
  mDbHelper=new BitherDatabaseHelper(mContext);
  mAddressDbHelper=new AddressDatabaseHelper(mContext);
  AndroidDbImpl androidDb=new AndroidDbImpl();
  androidDb.construct();
  AndroidImplAbstractApp appAndroid=new AndroidImplAbstractApp();
  appAndroid.construct();
  AbstractApp.notificationService.removeAddressLoadCompleteState();
  StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().permitDiskReads().permitDiskWrites().penaltyLog().build());
  Threading.throwOnLockCycles();
  initApp();
  mBitherApplication=this;
  ueHandler=new UEHandler();
  Thread.setDefaultUncaughtExceptionHandler(ueHandler);
  activityManager=(ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
}
Program: 63519
Project: 63519
Buggy source:
@Override public void runWithService(BlockchainService service){
  service.stopAndUnregister();
  for (  Address address : AddressManager.getInstance().getAllAddresses()) {
    address.setSyncComplete(false);
    address.updateSyncComplete();
  }
  HDAccountProvider.getInstance().setSyncdNotComplete();
  HDAccountProvider.getInstance().clearAllTx();
  TxProvider.getInstance().clearAllTx();
  for (  Address address : AddressManager.getInstance().getAllAddresses()) {
    address.notificatTx(null,Tx.TxNotificationType.txFromApi);
  }
  try {
    if (!AddressManager.getInstance().addressIsSyncComplete()) {
      TransactionsUtil.getMyTxFromBither();
    }
    service.startAndRegister();
    HotAdvanceActivity.this.runOnUiThread(new Runnable(){
      @Override public void run(){
        dp.dismiss();
        DropdownMessage.showDropdownMessage(HotAdvanceActivity.this,R.string.reload_tx_success);
      }
    }
);
  }
 catch (  Exception e) {
    e.printStackTrace();
    HotAdvanceActivity.this.runOnUiThread(new Runnable(){
      @Override public void run(){
        dp.dismiss();
        DropdownMessage.showDropdownMessage(HotAdvanceActivity.this,R.string.network_or_connection_error);
      }
    }
);
  }
}

Fixed version (ground truth):
@Override public void runWithService(BlockchainService service){
  service.stopAndUnregister();
  for (  Address address : AddressManager.getInstance().getAllAddresses()) {
    address.setSyncComplete(false);
    address.updateSyncComplete();
  }
  HDAccountProvider.getInstance().setSyncdNotComplete();
  TxProvider.getInstance().clearAllTx();
  for (  Address address : AddressManager.getInstance().getAllAddresses()) {
    address.notificatTx(null,Tx.TxNotificationType.txFromApi);
  }
  try {
    if (!AddressManager.getInstance().addressIsSyncComplete()) {
      TransactionsUtil.getMyTxFromBither();
    }
    service.startAndRegister();
    HotAdvanceActivity.this.runOnUiThread(new Runnable(){
      @Override public void run(){
        dp.dismiss();
        DropdownMessage.showDropdownMessage(HotAdvanceActivity.this,R.string.reload_tx_success);
      }
    }
);
  }
 catch (  Exception e) {
    e.printStackTrace();
    HotAdvanceActivity.this.runOnUiThread(new Runnable(){
      @Override public void run(){
        dp.dismiss();
        DropdownMessage.showDropdownMessage(HotAdvanceActivity.this,R.string.network_or_connection_error);
      }
    }
);
  }
}
Program: 63521
Project: 63521
Buggy source:
@Override public void onCreate(SQLiteDatabase db){
  createBlocksTable(db);
  createTxsTable(db);
  createAddressTxsTable(db);
  createInsTable(db);
  createOutsTable(db);
  createPeersTable(db);
}

Fixed version (ground truth):
@Override public void onCreate(SQLiteDatabase db){
  createBlocksTable(db);
  createTxsTable(db);
  createAddressTxsTable(db);
  createInsTable(db);
  createOutsTable(db);
  createPeersTable(db);
  createHDAccountAddress(db);
}
Program: 63522
Project: 63522
Buggy source:
@Override public void onUpgrade(SQLiteDatabase db,int oldVersion,int newVersion){
}

Fixed version (ground truth):
@Override public void onUpgrade(SQLiteDatabase db,int oldVersion,int newVersion){
switch (oldVersion) {
case 1:
    v1Tov2(db);
}
}
Program: 63523
Project: 63523
Buggy source:
@Override public long getConfirmedBanlance(){
  long sum=0;
  String unspendOutSql="String_Node_Str" + "String_Node_Str";
  SQLiteDatabase db=this.mDb.getReadableDatabase();
  Cursor c=db.rawQuery(unspendOutSql,new String[]{Integer.toString(Out.OutStatus.unspent.getValue())});
  if (c.moveToNext()) {
    int idColumn=c.getColumnIndex("String_Node_Str");
    if (idColumn != -1) {
      sum=c.getLong(idColumn);
    }
  }
  c.close();
  return sum;
}

Fixed version (ground truth):
@Override public long getConfirmedBanlance(){
  long sum=0;
  String unspendOutSql="String_Node_Str" + "String_Node_Str";
  SQLiteDatabase db=this.mDb.getReadableDatabase();
  Cursor c=db.rawQuery(unspendOutSql,new String[]{Integer.toString(Out.OutStatus.unspent.getValue()),"String_Node_Str"});
  if (c.moveToNext()) {
    int idColumn=c.getColumnIndex("String_Node_Str");
    if (idColumn != -1) {
      sum=c.getLong(idColumn);
    }
  }
  c.close();
  return sum;
}
Program: 63524
Project: 63524
Buggy source:
@Override public byte[] getInternalPub(int hdSeedId){
  byte[] pub=null;
  try {
    SQLiteDatabase db=this.mDb.getReadableDatabase();
    Cursor c=db.rawQuery("String_Node_Str",new String[]{Integer.toString(hdSeedId)});
    if (c.moveToNext()) {
      int idColumn=c.getColumnIndex(AbstractDb.HDAccountColumns.EXTERNAL_PUB);
      if (idColumn != -1) {
        String pubStr=c.getString(idColumn);
        pub=Base58.decode(pubStr);
      }
    }
  }
 catch (  AddressFormatException e) {
    e.printStackTrace();
  }
  return pub;
}

Fixed version (ground truth):
@Override public byte[] getInternalPub(int hdSeedId){
  byte[] pub=null;
  try {
    SQLiteDatabase db=this.mDb.getReadableDatabase();
    Cursor c=db.rawQuery("String_Node_Str",new String[]{Integer.toString(hdSeedId)});
    if (c.moveToNext()) {
      int idColumn=c.getColumnIndex(AbstractDb.HDAccountColumns.INTERNAL_PUB);
      if (idColumn != -1) {
        String pubStr=c.getString(idColumn);
        pub=Base58.decode(pubStr);
      }
    }
  }
 catch (  AddressFormatException e) {
    e.printStackTrace();
  }
  return pub;
}
Program: 63525
Project: 63525
Buggy source:
@Override public byte[] getExternalPub(int hdSeedId){
  byte[] pub=null;
  try {
    SQLiteDatabase db=this.mDb.getReadableDatabase();
    Cursor c=db.rawQuery("String_Node_Str",new String[]{Integer.toString(hdSeedId)});
    if (c.moveToNext()) {
      int idColumn=c.getColumnIndex(AbstractDb.HDAccountColumns.ENCRYPT_SEED);
      if (idColumn != -1) {
        String pubStr=c.getString(idColumn);
        pub=Base58.decode(pubStr);
      }
    }
  }
 catch (  AddressFormatException e) {
    e.printStackTrace();
  }
  return pub;
}

Fixed version (ground truth):
@Override public byte[] getExternalPub(int hdSeedId){
  byte[] pub=null;
  try {
    SQLiteDatabase db=this.mDb.getReadableDatabase();
    Cursor c=db.rawQuery("String_Node_Str",new String[]{Integer.toString(hdSeedId)});
    if (c.moveToNext()) {
      int idColumn=c.getColumnIndex(AbstractDb.HDAccountColumns.EXTERNAL_PUB);
      if (idColumn != -1) {
        String pubStr=c.getString(idColumn);
        pub=Base58.decode(pubStr);
      }
    }
  }
 catch (  AddressFormatException e) {
    e.printStackTrace();
  }
  return pub;
}
Program: 63526
Project: 63526
Buggy source:
@Override public List<HDAccount.HDAccountAddress> getSigningAddressesForInputs(List<In> inList){
  SQLiteDatabase db=this.mDb.getReadableDatabase();
  List<HDAccount.HDAccountAddress> hdAccountAddressList=new ArrayList<HDAccount.HDAccountAddress>();
  Cursor c;
  for (  In in : inList) {
    String sql="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str";
    OutPoint outPoint=in.getOutpoint();
    c=db.rawQuery(sql,new String[]{Base58.encode(outPoint.getTxHash()),Integer.toString(in.getInSn())});
    if (c.moveToNext()) {
      hdAccountAddressList.add(formatAddress(c));
    }
    c.close();
  }
  return hdAccountAddressList;
}

Fixed version (ground truth):
@Override public List<HDAccount.HDAccountAddress> getSigningAddressesForInputs(List<In> inList){
  SQLiteDatabase db=this.mDb.getReadableDatabase();
  List<HDAccount.HDAccountAddress> hdAccountAddressList=new ArrayList<HDAccount.HDAccountAddress>();
  Cursor c;
  for (  In in : inList) {
    String sql="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str";
    OutPoint outPoint=in.getOutpoint();
    c=db.rawQuery(sql,new String[]{Base58.encode(in.getPrevTxHash()),Integer.toString(outPoint.getOutSn())});
    if (c.moveToNext()) {
      hdAccountAddressList.add(formatAddress(c));
    }
    c.close();
  }
  return hdAccountAddressList;
}
Program: 63527
Project: 63527
Buggy source:
@Override public void onCreate(SQLiteDatabase db){
  db.execSQL(AbstractDb.CREATE_ADDRESSES_SQL);
  db.execSQL(AbstractDb.CREATE_HDM_BID_SQL);
  db.execSQL(AbstractDb.CREATE_HD_SEEDS_SQL);
  db.execSQL(AbstractDb.CREATE_HDM_ADDRESSES_SQL);
  db.execSQL(AbstractDb.CREATE_PASSWORD_SEED_SQL);
}

Fixed version (ground truth):
@Override public void onCreate(SQLiteDatabase db){
  db.execSQL(AbstractDb.CREATE_ADDRESSES_SQL);
  db.execSQL(AbstractDb.CREATE_HDM_BID_SQL);
  db.execSQL(AbstractDb.CREATE_HD_SEEDS_SQL);
  db.execSQL(AbstractDb.CREATE_HDM_ADDRESSES_SQL);
  db.execSQL(AbstractDb.CREATE_PASSWORD_SEED_SQL);
  db.execSQL(AbstractDb.CREATE_ALIASES_SQL);
}
Program: 63528
Project: 63528
Buggy source:
@Override public void onShow(DialogInterface dialog){
  if (showSigningInfo) {
    new Thread(){
      @Override public void run(){
        HDMAddress hdm=(HDMAddress)address;
        List<byte[]> signingPubs=tx.getIns().get(0).getP2SHPubKeys();
        boolean isHot=false;
        boolean isCold=false;
        boolean isServer=false;
        for (        byte[] pub : signingPubs) {
          if (!isHot && Arrays.equals(pub,hdm.getPubHot())) {
            isHot=true;
            continue;
          }
          if (!isCold && Arrays.equals(pub,hdm.getPubCold())) {
            isCold=true;
            continue;
          }
          if (!isServer && Arrays.equals(pub,hdm.getPubRemote())) {
            isServer=true;
            continue;
          }
        }
        final boolean _isHot=isHot;
        final boolean _isCold=isCold;
        final boolean _isServer=isServer;
        pb.post(new Runnable(){
          @Override public void run(){
            if (_isHot) {
              ivHot.setVisibility(View.VISIBLE);
            }
 else {
              ivHot.setVisibility(View.GONE);
            }
            if (_isCold) {
              ivCold.setVisibility(View.VISIBLE);
            }
 else {
              ivCold.setVisibility(View.GONE);
            }
            if (_isServer) {
              ivServer.setVisibility(View.VISIBLE);
            }
 else {
              ivServer.setVisibility(View.GONE);
            }
            pb.setVisibility(View.GONE);
          }
        }
);
      }
    }
.start();
  }
}

Fixed version (ground truth):
@Override public void onShow(DialogInterface dialog){
  if (showSigningInfo) {
    new Thread(){
      @Override public void run(){
        HDMAddress hdm=(HDMAddress)address;
        tx.getIns().get(0).setTx(tx);
        List<byte[]> signingPubs=tx.getIns().get(0).getP2SHPubKeys();
        boolean isHot=false;
        boolean isCold=false;
        boolean isServer=false;
        for (        byte[] pub : signingPubs) {
          if (!isHot && Arrays.equals(pub,hdm.getPubHot())) {
            isHot=true;
            continue;
          }
          if (!isCold && Arrays.equals(pub,hdm.getPubCold())) {
            isCold=true;
            continue;
          }
          if (!isServer && Arrays.equals(pub,hdm.getPubRemote())) {
            isServer=true;
            continue;
          }
        }
        final boolean _isHot=isHot;
        final boolean _isCold=isCold;
        final boolean _isServer=isServer;
        pb.post(new Runnable(){
          @Override public void run(){
            if (_isHot) {
              ivHot.setVisibility(View.VISIBLE);
            }
 else {
              ivHot.setVisibility(View.GONE);
            }
            if (_isCold) {
              ivCold.setVisibility(View.VISIBLE);
            }
 else {
              ivCold.setVisibility(View.GONE);
            }
            if (_isServer) {
              ivServer.setVisibility(View.VISIBLE);
            }
 else {
              ivServer.setVisibility(View.GONE);
            }
            pb.setVisibility(View.GONE);
          }
        }
);
      }
    }
.start();
  }
}
Program: 63529
Project: 63529
Buggy source:
@Override public void onUpgrade(SQLiteDatabase db,int oldVersion,int newVersion){
  if (oldVersion == 1 && newVersion == 2) {
    db.execSQL("String_Node_Str");
    db.execSQL(AbstractDb.CREATE_PASSWORD_SEED_SQL);
    String passwordSeedStr=AppSharedPreference.getInstance().getPasswordSeedString();
    db.execSQL("String_Node_Str",new String[]{passwordSeedStr});
  }
}

Fixed version (ground truth):
@Override public void onUpgrade(SQLiteDatabase db,int oldVersion,int newVersion){
  if (oldVersion == 1 && newVersion == 2) {
    db.execSQL("String_Node_Str");
    db.execSQL(AbstractDb.CREATE_PASSWORD_SEED_SQL);
    String passwordSeedStr=AppSharedPreference.getInstance().getPasswordSeedString();
    if (!Utils.isEmpty(passwordSeedStr)) {
      db.execSQL("String_Node_Str",new String[]{passwordSeedStr});
    }
  }
}
Program: 63530
Project: 63530
Buggy source:
@Override public void setEncryptSeed(int hdSeedId,String encryptedSeed){
  SQLiteDatabase db=this.mDb.getWritableDatabase();
  ContentValues cv=new ContentValues();
  cv.put(AbstractDb.HDSeedsColumns.ENCRYPT_SEED,encryptedSeed);
  db.update(AbstractDb.Tables.HDMAddresses,cv,"String_Node_Str",new String[]{Integer.toString(hdSeedId)});
}

Fixed version (ground truth):
@Override public void setEncryptSeed(int hdSeedId,String encryptedSeed){
  SQLiteDatabase db=this.mDb.getWritableDatabase();
  ContentValues cv=new ContentValues();
  cv.put(AbstractDb.HDSeedsColumns.ENCRYPT_SEED,encryptedSeed);
  db.update(AbstractDb.Tables.HDSeeds,cv,"String_Node_Str",new String[]{Integer.toString(hdSeedId)});
}
Program: 63531
Project: 63531
Buggy source:
@Override public boolean onLongClick(View v){
switch (groupTag) {
case PrivateGroupTag:
    new DialogAddressWithShowPrivateKey(activity,privates.get(position)).show();
case WatchOnlyGroupTag:
  new DialogAddressWatchOnlyLongClick(activity,watchOnlys.get(position)).show();
case HDMGroupTag:
}
return true;
}

Fixed version (ground truth):
@Override public boolean onLongClick(View v){
switch (groupTag) {
case PrivateGroupTag:
    new DialogAddressWithShowPrivateKey(activity,privates.get(position)).show();
  break;
case WatchOnlyGroupTag:
new DialogAddressWatchOnlyLongClick(activity,watchOnlys.get(position)).show();
break;
case HDMGroupTag:
break;
}
return true;
}
Program: 63532
Project: 63532
Buggy source:
@Override public int maxHDMAddressPubIndex(int hdSeedId){
  SQLiteDatabase db=this.mDb.getReadableDatabase();
  Cursor cursor=db.rawQuery("String_Node_Str",new String[]{Integer.toString(hdSeedId)});
  int maxIndex=0;
  int idColumn=cursor.getColumnIndex(AbstractDb.HDMAddressesColumns.HD_SEED_INDEX);
  if (idColumn != -1) {
    maxIndex=cursor.getInt(idColumn);
  }
  cursor.close();
  return maxIndex;
}

Fixed version (ground truth):
@Override public int maxHDMAddressPubIndex(int hdSeedId){
  SQLiteDatabase db=this.mDb.getReadableDatabase();
  Cursor cursor=db.rawQuery("String_Node_Str",new String[]{Integer.toString(hdSeedId)});
  int maxIndex=0;
  if (cursor.moveToNext()) {
    int idColumn=cursor.getColumnIndex(AbstractDb.HDMAddressesColumns.HD_SEED_INDEX);
    if (idColumn != -1) {
      maxIndex=cursor.getInt(idColumn);
    }
  }
  cursor.close();
  return maxIndex;
}
Program: 63533
Project: 63533
Buggy source:
@Override public int uncompletedHDMAddressCount(int hdSeedId){
  SQLiteDatabase db=this.mDb.getReadableDatabase();
  Cursor cursor=db.rawQuery("String_Node_Str",new String[]{Integer.toString(hdSeedId)});
  int count=0;
  int idColumn=cursor.getColumnIndex("String_Node_Str");
  if (idColumn != -1) {
    count=cursor.getInt(idColumn);
  }
  cursor.close();
  return count;
}

Fixed version (ground truth):
@Override public int uncompletedHDMAddressCount(int hdSeedId){
  SQLiteDatabase db=this.mDb.getReadableDatabase();
  Cursor cursor=db.rawQuery("String_Node_Str",new String[]{Integer.toString(hdSeedId)});
  int count=0;
  if (cursor.moveToNext()) {
    int idColumn=cursor.getColumnIndex("String_Node_Str");
    if (idColumn != -1) {
      count=cursor.getInt(idColumn);
    }
  }
  cursor.close();
  return count;
}
Program: 63534
Project: 63534
Buggy source:
@Override public void onPasswordEntered(String password){
  if (dp != null && !dp.isShowing()) {
    dp.setMessage(R.string.import_private_key_qr_code_importing);
    ImportPrivateKeyThread importPrivateKeyThread=new ImportPrivateKeyThread(content,password);
    importPrivateKeyThread.start();
  }
}

Fixed version (ground truth):
@Override public void onPasswordEntered(String password){
  if (dp != null && !dp.isShowing()) {
    dp.setMessage(R.string.import_private_key_qr_code_importing);
    dp.show();
    ImportPrivateKeyThread importPrivateKeyThread=new ImportPrivateKeyThread(content,password);
    importPrivateKeyThread.start();
  }
}
Program: 63535
Project: 63535
Buggy source:
public void setContent(String order,String price,String volume){
  this.tvOrder.setText(order);
  this.tvPrice.setText(price);
  this.tvVolume.setText("String_Node_Str" + volume);
  this.ivSymbolBtc.setImageBitmap(btcBit);
  this.tvSymbol.setText(AppSharedPreference.getInstance().getDefaultExchangeType().getSymbol());
}

Fixed version (ground truth):
public void setContent(String order,String price,String volume){
  this.tvOrder.setText(order);
  this.tvPrice.setText(price);
  this.tvVolume.setText(volume);
  this.ivSymbolBtc.setImageBitmap(btcBit);
  this.tvSymbol.setText(AppSharedPreference.getInstance().getDefaultExchangeType().getSymbol());
}
Program: 63536
Project: 63536
Buggy source:
private void comporePriceAlert(List<Ticker> tickerList){
  List<PriceAlert> priceAlertList=PriceAlert.getPriceAlertList();
  for (  PriceAlert priceAlert : priceAlertList) {
    for (    Ticker ticker : tickerList) {
      if (priceAlert.getMarketType() == ticker.getMarketType()) {
        if (priceAlert.getHigher() > 0 && ticker.getDefaultExchangeHigh() >= priceAlert.getHigher()) {
          notif(ticker.getMarketType(),true,priceAlert.getHigher());
          PriceAlert.removePriceAlert(priceAlert);
        }
        if (priceAlert.getLower() > 0 && ticker.getDefaultExchangeLow() <= priceAlert.getLower()) {
          notif(ticker.getMarketType(),false,priceAlert.getLower());
          PriceAlert.removePriceAlert(priceAlert);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void comporePriceAlert(List<Ticker> tickerList){
  List<PriceAlert> priceAlertList=PriceAlert.getPriceAlertList();
  for (  PriceAlert priceAlert : priceAlertList) {
    for (    Ticker ticker : tickerList) {
      if (priceAlert.getMarketType() == ticker.getMarketType()) {
        if (priceAlert.getExchangeHigher() > 0 && ticker.getDefaultExchangeHigh() >= priceAlert.getExchangeHigher()) {
          notif(ticker.getMarketType(),true,priceAlert.getExchangeHigher());
          PriceAlert.removePriceAlert(priceAlert);
        }
        if (priceAlert.getExchangeLower() > 0 && ticker.getDefaultExchangeLow() <= priceAlert.getExchangeLower()) {
          notif(ticker.getMarketType(),false,priceAlert.getExchangeLower());
          PriceAlert.removePriceAlert(priceAlert);
        }
      }
    }
  }
}
Program: 63537
Project: 63537
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.action_share:
    final CharSequence[] shareItems={getString(R.string.action_share_link),getString(R.string.action_share_comments)};
  new AlertDialog.Builder(getActivity()).setItems(shareItems,(dialogInterface,i) -> {
    Intent sendIntent=new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
switch (i) {
case 0:
      sendIntent.putExtra(Intent.EXTRA_TEXT,getViewModel().getStoryDetail().getUrl());
    break;
case 1:
  sendIntent.putExtra(Intent.EXTRA_TEXT,HACKER_NEWS_ITEM_BASE_URL + getViewModel().getStoryId());
break;
}
sendIntent.setType("String_Node_Str");
startActivity(sendIntent);
}
).create().show();
break;
case R.id.action_open_browser:
Intent browserIntent=new Intent();
browserIntent.setAction(Intent.ACTION_VIEW);
browserIntent.setData(Uri.parse(HACKER_NEWS_ITEM_BASE_URL + getViewModel().getStoryId()));
startActivity(browserIntent);
break;
}
return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.action_share:
    final CharSequence[] shareItems={getString(R.string.action_share_link),getString(R.string.action_share_comments)};
  new AlertDialog.Builder(getActivity()).setItems(shareItems,(dialogInterface,i) -> {
    Intent sendIntent=new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
switch (i) {
case 0:
      sendIntent.putExtra(Intent.EXTRA_TEXT,getViewModel().getStoryDetail().getUrl());
    break;
case 1:
  sendIntent.putExtra(Intent.EXTRA_TEXT,HACKER_NEWS_ITEM_BASE_URL + getViewModel().getStoryId());
break;
}
sendIntent.setType("String_Node_Str");
startActivity(sendIntent);
}
).create().show();
break;
case R.id.action_open_browser:
final CharSequence[] openInBrowserItems={getString(R.string.action_open_in_browser_link),getString(R.string.action_open_in_browser_comments)};
new AlertDialog.Builder(getActivity()).setItems(openInBrowserItems,(dialogInterface,i) -> {
Intent browserIntent=new Intent();
browserIntent.setAction(Intent.ACTION_VIEW);
switch (i) {
case 0:
browserIntent.setData(Uri.parse(getViewModel().getStoryDetail().getUrl()));
break;
case 1:
browserIntent.setData(Uri.parse(HACKER_NEWS_ITEM_BASE_URL + getViewModel().getStoryId()));
break;
}
startActivity(browserIntent);
}
).create().show();
break;
}
return super.onOptionsItemSelected(item);
}