nus-yam/ex-repair huggingface dataset:
Program: 146429
Project: 146429
Buggy source:
@Test public void getDispensingShouldGetItemsInTheListView() throws Exception {
  String commodityName="String_Node_Str";
  DispenseActivity dispenseActivity=getActivity();
  dispenseActivity.checkboxCommoditySelected.setChecked(true);
  ListView mockListView=mock(ListView.class);
  View mockListItemView=mock(View.class);
  EditText mockEditText=new EditText(application);
  SelectedCommoditiesAdapter mockSelectedCommoditiesAdapter=mock(SelectedCommoditiesAdapter.class);
  mockEditText.setText("String_Node_Str");
  Commodity commodity=new Commodity(commodityName);
  when(mockSelectedCommoditiesAdapter.getItem(anyInt())).thenReturn(new CommodityViewModel(commodity));
  when(mockListItemView.findViewById(R.id.editTextQuantity)).thenReturn(mockEditText);
  when(mockListView.getChildAt(anyInt())).thenReturn(mockListItemView);
  when(mockListView.getChildCount()).thenReturn(1);
  when(mockListView.getAdapter()).thenReturn(mockSelectedCommoditiesAdapter);
  dispenseActivity.listViewSelectedCommodities=mockListView;
  Dispensing dispensing=dispenseActivity.getDispensing();
  assertThat(dispensing.getDispensingItems().size(),is(1));
  assertThat(dispensing.isDispenseToFacility(),is(true));
  assertThat(dispensing.getDispensingItems().get(0).getQuantity(),is(12));
  assertThat(dispensing.getDispensingItems().get(0).getCommodity().getName(),is(commodityName));
}

Fixed version (ground truth):
@Test public void getDispensingShouldGetItemsInTheListView() throws Exception {
  String commodityName="String_Node_Str";
  DispenseActivity dispenseActivity=getDispenseActivity();
  dispenseActivity.checkboxCommoditySelected.setChecked(true);
  ListView mockListView=mock(ListView.class);
  View mockListItemView=mock(View.class);
  EditText mockEditText=new EditText(application);
  SelectedCommoditiesAdapter mockSelectedCommoditiesAdapter=mock(SelectedCommoditiesAdapter.class);
  mockEditText.setText("String_Node_Str");
  Commodity commodity=new Commodity(commodityName);
  when(mockSelectedCommoditiesAdapter.getItem(anyInt())).thenReturn(new CommodityViewModel(commodity));
  when(mockListItemView.findViewById(R.id.editTextQuantity)).thenReturn(mockEditText);
  when(mockListView.getChildAt(anyInt())).thenReturn(mockListItemView);
  when(mockListView.getChildCount()).thenReturn(1);
  when(mockListView.getAdapter()).thenReturn(mockSelectedCommoditiesAdapter);
  dispenseActivity.listViewSelectedCommodities=mockListView;
  Dispensing dispensing=dispenseActivity.getDispensing();
  assertThat(dispensing.getDispensingItems().size(),is(1));
  assertThat(dispensing.isDispenseToFacility(),is(true));
  assertThat(dispensing.getDispensingItems().get(0).getQuantity(),is(12));
  assertThat(dispensing.getDispensingItems().get(0).getCommodity().getName(),is(commodityName));
}
Program: 146430
Project: 146430
Buggy source:
@Test public void shouldRemoveSelectedCommodityFromListWhenCancelButtonIsClicked(){
  CommodityToggledEventDetails eventDetails=fireCommodityToggledEvent();
  SelectedCommoditiesAdapter adapter=eventDetails.dispenseActivity.selectedCommoditiesAdapter;
  ImageButton cancelButton=(ImageButton)getViewFromListRow(adapter,R.layout.selected_commodity_list_item,R.id.imageButtonCancel);
  cancelButton.performClick();
  assertFalse(eventDetails.dispenseActivity.selectedCommodities.contains(eventDetails.commodityViewModel()));
  assertThat(eventDetails.dispenseActivity.listViewSelectedCommodities.getAdapter().getCount(),is(0));
}

Fixed version (ground truth):
@Test public void shouldRemoveSelectedCommodityFromListWhenCancelButtonIsClicked(){
  CommodityToggledEventDetails eventDetails=fireCommodityToggledEvent(getDispenseActivity());
  SelectedCommoditiesAdapter adapter=eventDetails.dispenseActivity.selectedCommoditiesAdapter;
  ImageButton cancelButton=(ImageButton)getViewFromListRow(adapter,R.layout.selected_commodity_list_item,R.id.imageButtonCancel);
  cancelButton.performClick();
  assertFalse(eventDetails.dispenseActivity.selectedCommodities.contains(eventDetails.commodityViewModel()));
  assertThat(eventDetails.dispenseActivity.listViewSelectedCommodities.getAdapter().getCount(),is(0));
}
Program: 146431
Project: 146431
Buggy source:
@Test public void shouldToggleSelectedStatusOfCommodity(){
  CommodityViewModel commodity=new CommodityViewModel(new Commodity("String_Node_Str"));
  assertFalse(commodity.getSelected());
  commodity.toggleSelected();
  assertTrue(commodity.getSelected());
}

Fixed version (ground truth):
@Test public void shouldToggleSelectedStatusOfCommodity(){
  CommodityViewModel commodity=new CommodityViewModel(new Commodity("String_Node_Str"));
  assertFalse(commodity.isSelected());
  commodity.toggleSelected();
  assertTrue(commodity.isSelected());
}
Program: 146432
Project: 146432
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  LayoutInflater inflater=(LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View rowView=inflater.inflate(R.layout.selected_commodity_list_item,parent,false);
  TextView textViewCommodityName=(TextView)rowView.findViewById(R.id.textViewCommodityName);
  ImageButton imageButtonCancel=(ImageButton)rowView.findViewById(R.id.imageButtonCancel);
  final EditText editTextQuantity=(EditText)rowView.findViewById(R.id.editTextQuantity);
  final Commodity commodity=getItem(position);
  textViewCommodityName.setText(commodity.getName());
  TextWatcher watcher=new QuantityTextWatcher(editTextQuantity,commodity);
  editTextQuantity.addTextChangedListener(watcher);
  activateCancelButton(imageButtonCancel,commodity);
  return rowView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  LayoutInflater inflater=(LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View rowView=inflater.inflate(R.layout.selected_commodity_list_item,parent,false);
  TextView textViewCommodityName=(TextView)rowView.findViewById(R.id.textViewCommodityName);
  ImageButton imageButtonCancel=(ImageButton)rowView.findViewById(R.id.imageButtonCancel);
  final EditText editTextQuantity=(EditText)rowView.findViewById(R.id.editTextQuantity);
  final Commodity commodity=getItem(position);
  textViewCommodityName.setText(commodity.getName());
  TextWatcher watcher=new QuantityTextWatcher(editTextQuantity,commodity);
  editTextQuantity.addTextChangedListener(watcher);
  int quantity=commodity.getQuantityToDispense();
  if (quantity > 0)   editTextQuantity.setText(Integer.toString(quantity));
  activateCancelButton(imageButtonCancel,commodity);
  return rowView;
}
Program: 146433
Project: 146433
Buggy source:
@Override public void afterTextChanged(Editable editable){
  String value=editable.toString();
  if (!value.isEmpty()) {
    int quantity=Integer.parseInt(value);
    int stock_level=stockService.getStockLevelFor(commodity);
    if (quantity > stock_level) {
      editTextQuantity.setError(String.format("String_Node_Str",stock_level));
    }
  }
}

Fixed version (ground truth):
@Override public void afterTextChanged(Editable editable){
  String value=editable.toString();
  if (!value.isEmpty()) {
    int quantity=Integer.parseInt(value);
    int stock_level=stockService.getStockLevelFor(commodity);
    commodity.setQuantityToDispense(quantity);
    if (quantity > stock_level) {
      editTextQuantity.setError(String.format("String_Node_Str",stock_level));
    }
  }
}
Program: 146434
Project: 146434
Buggy source:
Boolean offlineCurrentAndLogin(){
  WifiManager wifi_service=(WifiManager)context.getSystemService(Context.WIFI_SERVICE);
  String macAddr=wifi_service.getConnectionInfo().getMacAddress();
  Log.d("String_Node_Str",macAddr);
  macAddr=macAddr.replaceAll("String_Node_Str","String_Node_Str");
  if (macAddr.equals("String_Node_Str")) {
    Log.d("String_Node_Str","String_Node_Str");
    return false;
  }
  for (  OnlineDevice device : onlineDevices) {
    if (device.mac.replaceAll("String_Node_Str","String_Node_Str").equals(macAddr)) {
      kick_ip_address=device.ip;
      session_id=device.session_id;
      nas_ip_address=device.nas_ip;
      if (offline()) {
        Log.d("String_Node_Str","String_Node_Str");
        new LoginTask(context).execute();
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
Boolean offlineCurrentAndLogin(){
  WifiManager wifi_service=(WifiManager)context.getSystemService(Context.WIFI_SERVICE);
  String macAddr=wifi_service.getConnectionInfo().getMacAddress();
  Log.d("String_Node_Str",macAddr);
  macAddr=macAddr.replaceAll("String_Node_Str","String_Node_Str");
  if (macAddr.equals("String_Node_Str")) {
    Log.d("String_Node_Str","String_Node_Str");
    return false;
  }
  getStates();
  for (  OnlineDevice device : onlineDevices) {
    if (device.mac.replaceAll("String_Node_Str","String_Node_Str").equals(macAddr)) {
      kick_ip_address=device.ip;
      session_id=device.session_id;
      nas_ip_address=device.nas_ip;
      if (offline()) {
        Log.d("String_Node_Str","String_Node_Str");
        new LoginTask(context).execute();
        return true;
      }
    }
  }
  return false;
}
Program: 146436
Project: 146436
Buggy source:
public Boolean getStates(){
  try {
    URI website=new URI("String_Node_Str");
    HttpGet request=new HttpGet(website);
    setGetHeader(request);
    HttpResponse response=client.execute(request);
    int statusCode=response.getStatusLine().getStatusCode();
    if (statusCode != 200) {
      Log.d("String_Node_Str","String_Node_Str" + String.valueOf(statusCode));
      return false;
    }
    String responseStr=EntityUtils.toString(response.getEntity(),"String_Node_Str");
    accountState=findInStr(responseStr,"String_Node_Str");
    onlineState=findInStr(responseStr,"String_Node_Str");
    usage=findInStr(responseStr,"String_Node_Str");
    Pattern p=Pattern.compile("String_Node_Str");
    Matcher m=p.matcher(responseStr);
    while (m.find() && m.groupCount() == 5) {
      onlineDevices.add(new OnlineDevice(m.group(2),m.group(3),m.group(1),m.group(4),m.group(5)));
    }
    website=new URI("String_Node_Str");
    request.setURI(website);
    response=client.execute(request);
    statusCode=response.getStatusLine().getStatusCode();
    if (statusCode != 200) {
      Log.d("String_Node_Str","String_Node_Str" + String.valueOf(statusCode));
      return false;
    }
    responseStr=EntityUtils.toString(response.getEntity(),"String_Node_Str");
    remainMoney=findInStr(responseStr,"String_Node_Str");
    return true;
  }
 catch (  Exception e) {
    Log.d("String_Node_Str","String_Node_Str" + e.toString());
    networkError=true;
    return false;
  }
}

Fixed version (ground truth):
public Boolean getStates(){
  try {
    URI website=new URI("String_Node_Str");
    HttpGet request=new HttpGet(website);
    setGetHeader(request);
    HttpResponse response=client.execute(request);
    int statusCode=response.getStatusLine().getStatusCode();
    if (statusCode != 200) {
      Log.d("String_Node_Str","String_Node_Str" + String.valueOf(statusCode));
      return false;
    }
    String responseStr=EntityUtils.toString(response.getEntity(),"String_Node_Str");
    accountState=findInStr(responseStr,"String_Node_Str");
    onlineState=findInStr(responseStr,"String_Node_Str");
    usage=findInStr(responseStr,"String_Node_Str");
    onlineDevices.clear();
    Pattern p=Pattern.compile("String_Node_Str");
    Matcher m=p.matcher(responseStr);
    while (m.find() && m.groupCount() == 5) {
      onlineDevices.add(new OnlineDevice(m.group(2),m.group(3),m.group(1),m.group(4),m.group(5)));
    }
    website=new URI("String_Node_Str");
    request.setURI(website);
    response=client.execute(request);
    statusCode=response.getStatusLine().getStatusCode();
    if (statusCode != 200) {
      Log.d("String_Node_Str","String_Node_Str" + String.valueOf(statusCode));
      return false;
    }
    responseStr=EntityUtils.toString(response.getEntity(),"String_Node_Str");
    remainMoney=findInStr(responseStr,"String_Node_Str");
    return true;
  }
 catch (  Exception e) {
    Log.d("String_Node_Str","String_Node_Str" + e.toString());
    networkError=true;
    return false;
  }
}
Program: 146437
Project: 146437
Buggy source:
@Override public void onStart(){
  super.onStart();
  accountCardText=(TextView)getActivity().findViewById(R.id.accountCard);
  accountStateText=(TextView)getActivity().findViewById(R.id.accountState);
  onlineStateText=(TextView)getActivity().findViewById(R.id.onlineState);
  onlineTable=(TableLayout)getActivity().findViewById(R.id.onlineTable);
  usageText=(TextView)getActivity().findViewById(R.id.usage);
  button_unlock=(Button)getActivity().findViewById(R.id.button_unlock);
  expireDateText=(TextView)getActivity().findViewById(R.id.expireDate);
  button_payfee=(Button)getActivity().findViewById(R.id.button_payfee);
  remainMoneyText=(TextView)getActivity().findViewById(R.id.remainMoney);
  buttonRecharge=(Button)getActivity().findViewById(R.id.buttonRecharge);
  onlineTable.setStretchAllColumns(true);
  builder=new AlertDialog.Builder(getActivity());
  unlockBuilder=new AlertDialog.Builder(getActivity());
  new NicTask(getActivity().getApplicationContext(),"String_Node_Str").execute();
  button_unlock.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      unlockBuilder.setTitle("String_Node_Str").setMessage("String_Node_Str").setPositiveButton(android.R.string.yes,new DialogInterface.OnClickListener(){
        public void onClick(        DialogInterface dialog,        int which){
          new NicTask(getActivity().getApplicationContext(),"String_Node_Str").execute();
        }
      }
).setNegativeButton(android.R.string.no,new DialogInterface.OnClickListener(){
        public void onClick(        DialogInterface dialog,        int which){
        }
      }
).setIcon(android.R.drawable.ic_dialog_alert).show();
    }
  }
);
  button_payfee.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      FragmentManager fm=getActivity().getSupportFragmentManager();
      PayFeeDialog editNameDialog=PayFeeDialog.newInstance(accountState);
      editNameDialog.show(fm,"String_Node_Str");
    }
  }
);
  buttonRecharge.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      FragmentManager fm=getActivity().getSupportFragmentManager();
      RechargeDialog rechargeDialog=RechargeDialog.newInstance(account);
      rechargeDialog.show(fm,"String_Node_Str");
    }
  }
);
}

Fixed version (ground truth):
@Override public void onStart(){
  super.onStart();
  refresh();
}
Program: 146438
Project: 146438
Buggy source:
public void accountOK(View view){
  EditText accountText=(EditText)findViewById(R.id.account_message);
  EditText passwdText=(EditText)findViewById(R.id.passwd_message);
  String account=accountText.getText().toString();
  String passwd=passwdText.getText().toString();
  if (account.isEmpty() || passwd.isEmpty()) {
    Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
    return;
  }
 else {
    InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    if (view.getWindowToken() != null) {
      imm.hideSoftInputFromWindow(view.getWindowToken(),0);
    }
    Editor editor=getSharedPreferences("String_Node_Str",Context.MODE_PRIVATE).edit();
    editor.putString("String_Node_Str",account);
    editor.putString("String_Node_Str",passwd);
    editor.commit();
    nicFragment.refresh();
    WifiManager wifi_service=(WifiManager)getApplicationContext().getSystemService(Context.WIFI_SERVICE);
    String ssid=wifi_service.getConnectionInfo().getSSID();
    if (ssid.startsWith("String_Node_Str") && ssid.endsWith("String_Node_Str")) {
      ssid=ssid.substring(1,ssid.length() - 1);
    }
    if (checkSsid(ssid)) {
      Log.d("String_Node_Str","String_Node_Str" + ssid);
      new LoginTask(getApplicationContext()).execute();
    }
    Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
  }
}

Fixed version (ground truth):
public void accountOK(View view){
  EditText accountText=(EditText)findViewById(R.id.account_message);
  EditText passwdText=(EditText)findViewById(R.id.passwd_message);
  String account=accountText.getText().toString();
  String passwd=passwdText.getText().toString();
  if (account.isEmpty() || passwd.isEmpty()) {
    Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
    return;
  }
 else   if (accountText == null || passwdText == null) {
    Log.d("String_Node_Str","String_Node_Str");
    return;
  }
 else {
    InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    if (view.getWindowToken() != null) {
      imm.hideSoftInputFromWindow(view.getWindowToken(),0);
    }
    Editor editor=getSharedPreferences("String_Node_Str",Context.MODE_PRIVATE).edit();
    editor.putString("String_Node_Str",account);
    editor.putString("String_Node_Str",passwd);
    editor.commit();
    if (nicFragment != null)     nicFragment.refresh();
    WifiManager wifi_service=(WifiManager)getApplicationContext().getSystemService(Context.WIFI_SERVICE);
    String ssid=wifi_service.getConnectionInfo().getSSID();
    if (ssid.startsWith("String_Node_Str") && ssid.endsWith("String_Node_Str")) {
      ssid=ssid.substring(1,ssid.length() - 1);
    }
    if (checkSsid(ssid)) {
      Log.d("String_Node_Str","String_Node_Str" + ssid);
      new LoginTask(getApplicationContext()).execute();
    }
    Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
  }
}
Program: 146439
Project: 146439
Buggy source:
protected Boolean doInBackground(BasicNameValuePair... params){
  if (params.length > 0 && params[0].getName().equals("String_Node_Str")) {
    try {
      retrys=Integer.parseInt(params[0].getValue()) + 1;
    }
 catch (    NumberFormatException e) {
      Log.d("String_Node_Str","String_Node_Str" + e.toString());
      return false;
    }
  }
  if (checkLogin()) {
    alreadyLoggedIn=true;
  }
 else {
    SharedPreferences sp=context.getSharedPreferences("String_Node_Str",Context.MODE_PRIVATE);
    account=sp.getString("String_Node_Str","String_Node_Str");
    passwd=sp.getString("String_Node_Str","String_Node_Str");
    if (account.equals("String_Node_Str") || passwd.equals("String_Node_Str")) {
      Log.d("String_Node_Str","String_Node_Str");
      return false;
    }
    if (login()) {
      Log.d("String_Node_Str","String_Node_Str");
      return true;
    }
 else {
      Log.d("String_Node_Str","String_Node_Str");
      return false;
    }
  }
  return false;
}

Fixed version (ground truth):
protected Boolean doInBackground(BasicNameValuePair... params){
  if (params.length > 0 && params[0].getName().equals("String_Node_Str")) {
    try {
      retrys=Integer.parseInt(params[0].getValue()) + 1;
    }
 catch (    NumberFormatException e) {
      Log.d("String_Node_Str","String_Node_Str" + e.toString());
      return false;
    }
  }
  if (checkLogin())   return false;
 else   if (retry) {
    retry();
    return false;
  }
 else {
    SharedPreferences sp=context.getSharedPreferences("String_Node_Str",Context.MODE_PRIVATE);
    account=sp.getString("String_Node_Str","String_Node_Str");
    passwd=sp.getString("String_Node_Str","String_Node_Str");
    if (account.equals("String_Node_Str") || passwd.equals("String_Node_Str")) {
      Log.d("String_Node_Str","String_Node_Str");
      return false;
    }
    if (login()) {
      Log.d("String_Node_Str","String_Node_Str");
      return true;
    }
 else     if (retry) {
      retry();
      return false;
    }
 else {
      Log.d("String_Node_Str","String_Node_Str");
      return false;
    }
  }
}
Program: 146440
Project: 146440
Buggy source:
protected void onPostExecute(Boolean result){
  SQLiteHelper db=new SQLiteHelper(context);
  if (result) {
    db.addLog("String_Node_Str");
    Toast.makeText(context.getApplicationContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
  }
 else   if (retrys >= 3) {
    Log.d("String_Node_Str","String_Node_Str");
    db.addLog("String_Node_Str");
    Toast.makeText(context.getApplicationContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
  }
 else   if (exceedError) {
    db.addLog("String_Node_Str");
    Toast.makeText(context.getApplicationContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
  }
 else   if (passwdError) {
    db.addLog("String_Node_Str");
    Toast.makeText(context.getApplicationContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
  }
 else   if (alreadyLoggedIn) {
    db.addLog("String_Node_Str");
    Toast.makeText(context.getApplicationContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
  }
}

Fixed version (ground truth):
protected void onPostExecute(Boolean result){
  if (retry)   return;
  SQLiteHelper db=new SQLiteHelper(context);
  if (result) {
    db.addLog("String_Node_Str");
    Toast.makeText(context.getApplicationContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
  }
 else   if (retrys >= 3) {
    Log.d("String_Node_Str","String_Node_Str");
    db.addLog("String_Node_Str");
    Toast.makeText(context.getApplicationContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
  }
 else   if (exceedError) {
    db.addLog("String_Node_Str");
    Toast.makeText(context.getApplicationContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
  }
 else   if (passwdError) {
    db.addLog("String_Node_Str");
    Toast.makeText(context.getApplicationContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
  }
 else   if (alreadyLoggedIn) {
    db.addLog("String_Node_Str");
    Toast.makeText(context.getApplicationContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
  }
}
Program: 146441
Project: 146441
Buggy source:
public Boolean login(){
  try {
    HttpClient client=new DefaultHttpClient();
    URI website=new URI("String_Node_Str");
    HttpPost request=new HttpPost(website);
    List<NameValuePair> nameValuePairs=new ArrayList<NameValuePair>(2);
    nameValuePairs.add(new BasicNameValuePair("String_Node_Str",account));
    nameValuePairs.add(new BasicNameValuePair("String_Node_Str",passwd));
    request.setEntity(new UrlEncodedFormEntity(nameValuePairs));
    request.setHeader("String_Node_Str","String_Node_Str" + android.os.Build.VERSION.RELEASE + "String_Node_Str"+ version);
    HttpResponse response=client.execute(request);
    int statusCode=response.getStatusLine().getStatusCode();
    if (statusCode == 200) {
      String responseStr=EntityUtils.toString(response.getEntity(),"String_Node_Str");
      if (responseStr.contains("String_Node_Str")) {
        Log.d("String_Node_Str","String_Node_Str" + String.valueOf(statusCode));
        return true;
      }
 else       if (responseStr.contains("String_Node_Str")) {
        Log.d("String_Node_Str","String_Node_Str");
        exceedError=true;
      }
 else       if (responseStr.contains("String_Node_Str")) {
        Log.d("String_Node_Str","String_Node_Str");
        passwdError=true;
      }
      return false;
    }
 else {
      Log.d("String_Node_Str","String_Node_Str" + String.valueOf(statusCode));
      return false;
    }
  }
 catch (  Exception e) {
    Log.d("String_Node_Str","String_Node_Str" + e.toString());
    retry();
    return false;
  }
}

Fixed version (ground truth):
public Boolean login(){
  try {
    HttpClient client=new DefaultHttpClient();
    URI website=new URI("String_Node_Str");
    HttpPost request=new HttpPost(website);
    List<NameValuePair> nameValuePairs=new ArrayList<NameValuePair>(2);
    nameValuePairs.add(new BasicNameValuePair("String_Node_Str",account));
    nameValuePairs.add(new BasicNameValuePair("String_Node_Str",passwd));
    request.setEntity(new UrlEncodedFormEntity(nameValuePairs));
    request.setHeader("String_Node_Str","String_Node_Str" + android.os.Build.VERSION.RELEASE + "String_Node_Str"+ version);
    HttpResponse response=client.execute(request);
    int statusCode=response.getStatusLine().getStatusCode();
    if (statusCode == 200) {
      String responseStr=EntityUtils.toString(response.getEntity(),"String_Node_Str");
      if (responseStr.contains("String_Node_Str")) {
        return true;
      }
 else       if (responseStr.contains("String_Node_Str")) {
        Log.d("String_Node_Str","String_Node_Str");
        exceedError=true;
      }
 else       if (responseStr.contains("String_Node_Str")) {
        Log.d("String_Node_Str","String_Node_Str");
        passwdError=true;
      }
      return false;
    }
 else {
      Log.d("String_Node_Str","String_Node_Str" + String.valueOf(statusCode));
      return false;
    }
  }
 catch (  Exception e) {
    Log.d("String_Node_Str","String_Node_Str" + e.toString());
    retry=true;
    return false;
  }
}
Program: 146442
Project: 146442
Buggy source:
public Boolean checkLogin(){
  try {
    HttpClient client=new DefaultHttpClient();
    URI website=new URI("String_Node_Str");
    HttpGet request=new HttpGet();
    request.setHeader("String_Node_Str","String_Node_Str" + android.os.Build.VERSION.RELEASE + "String_Node_Str"+ version);
    request.setURI(website);
    HttpResponse response=client.execute(request);
    String responseStr=EntityUtils.toString(response.getEntity());
    if (responseStr.contains("String_Node_Str")) {
      Log.d("String_Node_Str","String_Node_Str");
      return true;
    }
 else {
      return false;
    }
  }
 catch (  UnknownHostException e) {
    Log.d("String_Node_Str","String_Node_Str");
    retry();
    return false;
  }
catch (  Exception e) {
    Log.d("String_Node_Str","String_Node_Str" + e.toString());
    return false;
  }
}

Fixed version (ground truth):
public Boolean checkLogin(){
  try {
    HttpClient client=new DefaultHttpClient();
    URI website=new URI("String_Node_Str");
    HttpGet request=new HttpGet();
    request.setHeader("String_Node_Str","String_Node_Str" + android.os.Build.VERSION.RELEASE + "String_Node_Str"+ version);
    request.setURI(website);
    HttpResponse response=client.execute(request);
    String responseStr=EntityUtils.toString(response.getEntity());
    if (responseStr.contains("String_Node_Str")) {
      alreadyLoggedIn=true;
      Log.d("String_Node_Str","String_Node_Str");
      return true;
    }
 else {
      return false;
    }
  }
 catch (  UnknownHostException e) {
    Log.d("String_Node_Str","String_Node_Str");
    retry=true;
    return false;
  }
catch (  Exception e) {
    Log.d("String_Node_Str","String_Node_Str" + e.toString());
    return false;
  }
}
Program: 146443
Project: 146443
Buggy source:
public void retry(){
  if (retrys < 3) {
    Log.d("String_Node_Str","String_Node_Str" + String.valueOf(retrys));
    String UNIQUE_STRING="String_Node_Str";
    Intent intent=new Intent(UNIQUE_STRING);
    intent.putExtra("String_Node_Str",String.valueOf(retrys));
    context.sendBroadcast(intent);
  }
}

Fixed version (ground truth):
public void retry(){
  if (retrys < 3) {
    Log.d("String_Node_Str","String_Node_Str" + String.valueOf(retrys));
    String UNIQUE_STRING="String_Node_Str";
    Intent intent=new Intent(UNIQUE_STRING);
    intent.putExtra("String_Node_Str",String.valueOf(retrys));
    context.sendBroadcast(intent);
  }
 else   retry=false;
}
Program: 146444
Project: 146444
Buggy source:
public Boolean checkLogin(){
  try {
    HttpClient client=new DefaultHttpClient();
    URI website=new URI("String_Node_Str");
    HttpGet request=new HttpGet();
    request.setHeader("String_Node_Str","String_Node_Str" + android.os.Build.VERSION.RELEASE + "String_Node_Str"+ version);
    request.setURI(website);
    HttpResponse response=client.execute(request);
    String responseStr=EntityUtils.toString(response.getEntity());
    if (responseStr.contains("String_Node_Str")) {
      alreadyLoggedIn=true;
      Log.d("String_Node_Str","String_Node_Str");
      return true;
    }
 else {
      return false;
    }
  }
 catch (  UnknownHostException e) {
    Log.d("String_Node_Str","String_Node_Str");
    retry=true;
    return false;
  }
catch (  Exception e) {
    Log.d("String_Node_Str","String_Node_Str" + e.toString());
    return false;
  }
}

Fixed version (ground truth):
public Boolean checkLogin(){
  try {
    HttpClient client=new DefaultHttpClient();
    URI website=new URI("String_Node_Str");
    HttpGet request=new HttpGet();
    request.setHeader("String_Node_Str","String_Node_Str" + android.os.Build.VERSION.RELEASE + "String_Node_Str"+ version);
    request.setURI(website);
    HttpResponse response=client.execute(request);
    String responseStr=EntityUtils.toString(response.getEntity());
    if (responseStr.contains("String_Node_Str")) {
      alreadyLoggedIn=true;
      Log.d("String_Node_Str","String_Node_Str");
      return true;
    }
 else {
      return false;
    }
  }
 catch (  Exception e) {
    Log.d("String_Node_Str","String_Node_Str" + e.toString());
    retry=true;
    return false;
  }
}
Program: 146445
Project: 146445
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  final ActionBar actionBar=getSupportActionBar();
  actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
  mSectionsPagerAdapter=new SectionsPagerAdapter(getSupportFragmentManager());
  mViewPager=(ViewPager)findViewById(R.id.pager);
  mViewPager.setAdapter(mSectionsPagerAdapter);
  mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener(){
    @Override public void onPageSelected(    int position){
      actionBar.setSelectedNavigationItem(position);
    }
  }
);
  for (int i=0; i < mSectionsPagerAdapter.getCount(); i++) {
    actionBar.addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  final ActionBar actionBar=getSupportActionBar();
  actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
  mSectionsPagerAdapter=new SectionsPagerAdapter(getSupportFragmentManager());
  mViewPager=(ViewPager)findViewById(R.id.pager);
  mViewPager.setAdapter(mSectionsPagerAdapter);
  mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener(){
    @Override public void onPageSelected(    int position){
      actionBar.setSelectedNavigationItem(position);
    }
  }
);
  for (int i=0; i < mSectionsPagerAdapter.getCount(); i++) {
    actionBar.addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
  }
  getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
}
Program: 146446
Project: 146446
Buggy source:
public void onDateSet(DatePicker view,int year,int month,int day){
  Log.d("String_Node_Str",("String_Node_Str" + String.valueOf(year) + String.valueOf(month)+ String.valueOf(day)));
}

Fixed version (ground truth):
public void onDateSet(DatePicker view,int year,int month,int day){
  SQLiteHelper db=new SQLiteHelper(getActivity());
  String dateStamp=String.format("String_Node_Str",year).replace(' ','0') + String.format("String_Node_Str",month + 1).replace(' ','0') + String.format("String_Node_Str",day).replace(' ','0');
  Button button=(Button)getActivity().findViewById(R.id.button_changeDate);
  button.setText(dateStamp);
  List<String> dbLogList=db.getLogsByDate(dateStamp);
  String[] logs=dbLogList.toArray(new String[dbLogList.size()]);
  ListView logList=(ListView)getActivity().findViewById(R.id.logList);
  logList.setAdapter(new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1,logs));
  Log.d("String_Node_Str",("String_Node_Str" + dateStamp));
}
Program: 146447
Project: 146447
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View rootView=inflater.inflate(R.layout.fragment_log,container,false);
  Button button=(Button)rootView.findViewById(R.id.button_changeDate);
  ListView logList=(ListView)rootView.findViewById(R.id.logList);
  String dateStamp=new SimpleDateFormat("String_Node_Str",java.util.Locale.getDefault()).format(Calendar.getInstance().getTime());
  button.setText(dateStamp);
  SQLiteHelper db=new SQLiteHelper(getActivity());
  List<String> dbLogList=db.getLogsByDate(dateStamp);
  String[] logs=dbLogList.toArray(new String[dbLogList.size()]);
  logList.setAdapter(new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1,logs));
  return rootView;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View rootView=inflater.inflate(R.layout.fragment_log,container,false);
  Button button=(Button)rootView.findViewById(R.id.button_changeDate);
  String dateStamp=new SimpleDateFormat("String_Node_Str",java.util.Locale.getDefault()).format(Calendar.getInstance().getTime());
  button.setText(dateStamp);
  return rootView;
}
Program: 146448
Project: 146448
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  getMenuInflater().inflate(R.menu.main,menu);
  InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  imm.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(),0);
  return true;
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  getMenuInflater().inflate(R.menu.main,menu);
  return true;
}
Program: 146449
Project: 146449
Buggy source:
public void addLog(String log){
  SQLiteDatabase db=this.getWritableDatabase();
  ContentValues values=new ContentValues();
  java.util.Date d=Calendar.getInstance().getTime();
  String dateStamp=new SimpleDateFormat("String_Node_Str",java.util.Locale.getDefault()).format(d);
  String timeStamp=new SimpleDateFormat("String_Node_Str",java.util.Locale.getDefault()).format(d);
  values.put(DATE,dateStamp);
  values.put(MSG,timeStamp + "String_Node_Str" + log);
  db.insert(TABLE_LOG,null,values);
  db.close();
  Log.d("String_Node_Str",log + dateStamp + timeStamp);
}

Fixed version (ground truth):
public void addLog(String log){
  SQLiteDatabase db=this.getWritableDatabase();
  ContentValues values=new ContentValues();
  java.util.Date d=Calendar.getInstance().getTime();
  String dateStamp=new SimpleDateFormat("String_Node_Str",java.util.Locale.getDefault()).format(d);
  String timeStamp=new SimpleDateFormat("String_Node_Str",java.util.Locale.getDefault()).format(d);
  values.put(DATE,dateStamp);
  values.put(MSG,timeStamp + "String_Node_Str" + log);
  db.insert(TABLE_LOG,null,values);
  db.close();
  Log.d("String_Node_Str",log + dateStamp + timeStamp);
  if (Calendar.getInstance().get(Calendar.DAY_OF_MONTH) <= 3) {
    cleanOldLogs();
  }
}
Program: 146450
Project: 146450
Buggy source:
public Boolean cleanOldLogs(){
  String dateStamp=new SimpleDateFormat("String_Node_Str",java.util.Locale.getDefault()).format(Calendar.getInstance().getTime());
  SQLiteDatabase db=this.getWritableDatabase();
  db.delete(TABLE_LOG,DATE + "String_Node_Str",new String[]{dateStamp});
  db.close();
  return true;
}

Fixed version (ground truth):
public Boolean cleanOldLogs(){
  Calendar cal=Calendar.getInstance();
  cal.set(Calendar.MONTH,cal.get(Calendar.MONTH) - 1);
  String dateStamp=new SimpleDateFormat("String_Node_Str",java.util.Locale.getDefault()).format(cal.getTime());
  SQLiteDatabase db=this.getWritableDatabase();
  int count=db.delete(TABLE_LOG,DATE + "String_Node_Str",new String[]{dateStamp});
  db.close();
  Log.d("String_Node_Str",String.valueOf(count) + "String_Node_Str" + dateStamp);
  return true;
}
Program: 146451
Project: 146451
Buggy source:
public List<String> getLogsByDate(String date){
  List<String> logs=new LinkedList<String>();
  String query="String_Node_Str" + TABLE_LOG + "String_Node_Str"+ date;
  SQLiteDatabase db=this.getReadableDatabase();
  Cursor cursor=db.rawQuery(query,null);
  Log.d("String_Node_Str",String.valueOf(cursor.getCount()));
  if (cursor.moveToFirst()) {
    do {
      String log=cursor.getString(2);
      logs.add(log);
    }
 while (cursor.moveToNext());
  }
  db.close();
  Log.d("String_Node_Str" + date,logs.toString());
  return logs;
}

Fixed version (ground truth):
public List<String> getLogsByDate(String date){
  List<String> logs=new LinkedList<String>();
  String query="String_Node_Str" + TABLE_LOG + "String_Node_Str"+ date;
  SQLiteDatabase db=this.getReadableDatabase();
  Cursor cursor=db.rawQuery(query,null);
  if (cursor.moveToFirst()) {
    do {
      String log=cursor.getString(2);
      logs.add(log);
    }
 while (cursor.moveToNext());
  }
  db.close();
  Log.d("String_Node_Str" + date,logs.toString());
  return logs;
}
Program: 146452
Project: 146452
Buggy source:
public static void trackAppLaunch(Context context){
  SharedPreferences prefs=context.getSharedPreferences(APPRATER_LOG_FILENAME,Context.MODE_PRIVATE);
  if (prefs.getBoolean(DONT_SHOW_AGAIN_KEY,false)) {
    return;
  }
  SharedPreferences.Editor editor=prefs.edit();
  long launchCount=prefs.getLong(LAUNCH_COUNT_KEY,0) + 1;
  editor.putLong(LAUNCH_COUNT_KEY,launchCount);
  long firstLaunchTimestamp=prefs.getLong(FIRST_LAUNCH_TIMESTAMP,0);
  if (firstLaunchTimestamp == 0) {
    firstLaunchTimestamp=System.currentTimeMillis();
    editor.putLong(FIRST_LAUNCH_TIMESTAMP,firstLaunchTimestamp);
  }
  if (launchCount >= LAUNCHES_UNTIL_PROMPT) {
    if (System.currentTimeMillis() >= firstLaunchTimestamp + TimeUnit.DAYS.toMillis(DAYS_UNTIL_PROMPT)) {
      showRateDialog(context,editor);
    }
  }
  editor.apply();
}

Fixed version (ground truth):
public static void trackAppLaunch(Context context){
  SharedPreferences prefs=context.getSharedPreferences(APPRATER_LOG_FILENAME,Context.MODE_PRIVATE);
  if (prefs.getBoolean(DONT_SHOW_AGAIN_KEY,false)) {
    return;
  }
  SharedPreferences.Editor editor=prefs.edit();
  long launchCount=prefs.getLong(LAUNCH_COUNT_KEY,0) + 1;
  editor.putLong(LAUNCH_COUNT_KEY,launchCount);
  long firstLaunchTimestamp=prefs.getLong(FIRST_LAUNCH_TIMESTAMP,0);
  if (firstLaunchTimestamp == 0) {
    firstLaunchTimestamp=System.currentTimeMillis();
    editor.putLong(FIRST_LAUNCH_TIMESTAMP,firstLaunchTimestamp);
  }
  if (launchCount >= LAUNCHES_UNTIL_PROMPT && (System.currentTimeMillis() >= firstLaunchTimestamp + TimeUnit.DAYS.toMillis(DAYS_UNTIL_PROMPT))) {
    showRateDialog(context,editor);
  }
  editor.apply();
}
Program: 146453
Project: 146453
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  int viewType=getItemViewType(position);
switch (viewType) {
case TYPE_ITEM:
    convertView=createOrBindItemType(position,convertView,parent);
  break;
case TYPE_SEPARATOR:
if (convertView == null) {
  convertView=LayoutInflater.from(context).inflate(R.layout.view_pair_separator,parent,false);
}
break;
}
return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  int viewType=getItemViewType(position);
switch (viewType) {
case TYPE_ITEM:
    convertView=createOrBindItemType(position,convertView,parent);
  break;
case TYPE_SEPARATOR:
if (convertView == null) {
  convertView=LayoutInflater.from(context).inflate(R.layout.view_pair_separator,parent,false);
}
break;
default :
break;
}
return convertView;
}
Program: 146454
Project: 146454
Buggy source:
/** 
 * Get depth for the given pair
 * @param pair Pair (in app format, ex. "BTC/USD")
 * @return Depth call result
 */
@NonNull @WorkerThread public CallResult<Depth> depth(@NonNull String pair){
  pair=PairUtils.localToServer(pair);
  final String url=hostUrl + "String_Node_Str" + pair;
  JsonObject response=guestApi.call(url);
  CallResult<Depth> result=new CallResult<>();
  if (response == null || response.has(SUCCESS_KEY)) {
    result.isSuccess=false;
    result.error=response == null ? generalErrorText : response.get(ERROR_KEY).getAsString();
    return result;
  }
  result.isSuccess=true;
  result.payload=Depth.create(pair,response.getAsJsonObject(pair));
  return result;
}

Fixed version (ground truth):
/** 
 * Get depth for the given pair
 * @param pair Pair (in app format, ex. "BTC/USD")
 * @return Depth call result
 */
@NonNull @WorkerThread public CallResult<Depth> depth(@NonNull String pair){
  final String serverPair=PairUtils.localToServer(pair);
  final String url=hostUrl + "String_Node_Str" + serverPair;
  JsonObject response=guestApi.call(url);
  CallResult<Depth> result=new CallResult<>();
  if (response == null || response.has(SUCCESS_KEY)) {
    result.isSuccess=false;
    result.error=response == null ? generalErrorText : response.get(ERROR_KEY).getAsString();
    return result;
  }
  result.isSuccess=true;
  result.payload=Depth.create(pair,response.getAsJsonObject(serverPair));
  return result;
}
Program: 146455
Project: 146455
Buggy source:
/** 
 * Converts byte array to HEX string
 * @param array String as array of bytes
 * @return String in HEX format
 */
private String byteArrayToHexString(byte[] array){
  StringBuilder hexString=new StringBuilder();
  for (  byte b : array) {
    int intVal=b & 0xff;
    if (intVal < 0x10)     hexString.append("String_Node_Str");
    hexString.append(Integer.toHexString(intVal));
  }
  return hexString.toString();
}

Fixed version (ground truth):
/** 
 * Converts byte array to HEX string
 * @param array String as array of bytes
 * @return String in HEX format
 */
private String byteArrayToHexString(byte[] array){
  StringBuilder hexString=new StringBuilder();
  for (  byte b : array) {
    int intVal=b & 0xff;
    if (intVal < 0x10) {
      hexString.append('0');
    }
    hexString.append(Integer.toHexString(intVal));
  }
  return hexString.toString();
}
Program: 146457
Project: 146457
Buggy source:
CallResult(){
}

Fixed version (ground truth):
/** 
 * Creates new instance
 */
CallResult(){
}
Program: 146458
Project: 146458
Buggy source:
/** 
 * Makes simple non-authenticated request
 * @param urlString URL of Public API
 * @return Response of type {@link JsonObject}
 */
@Nullable JsonObject call(@NonNull String urlString){
  HttpURLConnection connection=null;
  BufferedReader rd=null;
  if (BuildConfig.DEBUG) {
    Log.d(TAG,"String_Node_Str" + urlString);
  }
  try {
    URL url=new URL(urlString);
    connection=(HttpURLConnection)url.openConnection();
    connection.setConnectTimeout((int)TimeUnit.SECONDS.toMillis(5));
    connection.setReadTimeout((int)TimeUnit.SECONDS.toMillis(30));
    InputStream response=connection.getInputStream();
    StringBuilder sb=new StringBuilder();
    if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
      rd=new BufferedReader(new InputStreamReader(response));
      String line;
      while ((line=rd.readLine()) != null) {
        sb.append(line);
      }
      return JSON_PARSER.parse(sb.toString()).getAsJsonObject();
    }
  }
 catch (  IOException e) {
    logException(e);
  }
catch (  JsonParseException jpe) {
    logException(jpe);
  }
 finally {
    if (connection != null) {
      connection.disconnect();
    }
    if (rd != null) {
      try {
        rd.close();
      }
 catch (      IOException e) {
        logException(e);
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Makes simple non-authenticated request
 * @param urlString URL of Public API
 * @return Response of type {@link JsonObject}
 */
@Nullable JsonObject call(@NonNull String urlString){
  HttpURLConnection connection=null;
  BufferedReader rd=null;
  if (BuildConfig.DEBUG) {
    Log.d(TAG,"String_Node_Str" + urlString);
  }
  try {
    URL url=new URL(urlString);
    connection=(HttpURLConnection)url.openConnection();
    connection.setConnectTimeout((int)TimeUnit.SECONDS.toMillis(5));
    connection.setReadTimeout((int)TimeUnit.SECONDS.toMillis(30));
    InputStream response=connection.getInputStream();
    StringBuilder sb=new StringBuilder();
    if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
      rd=new BufferedReader(new InputStreamReader(response,"String_Node_Str"));
      String line;
      while ((line=rd.readLine()) != null) {
        sb.append(line);
      }
      return JSON_PARSER.parse(sb.toString()).getAsJsonObject();
    }
  }
 catch (  IOException e) {
    logException(e);
  }
catch (  JsonParseException jpe) {
    logException(jpe);
  }
 finally {
    if (connection != null) {
      connection.disconnect();
    }
    if (rd != null) {
      try {
        rd.close();
      }
 catch (      IOException e) {
        logException(e);
      }
    }
  }
  return null;
}
Program: 146459
Project: 146459
Buggy source:
@NonNull public long getId(){
  return id;
}

Fixed version (ground truth):
public long getId(){
  return id;
}
Program: 146460
Project: 146460
Buggy source:
public static DBWorker getInstance(Context context){
  DBWorker localInstance=sInstance;
  if (localInstance == null) {
synchronized (DBWorker.class) {
      localInstance=sInstance;
      if (localInstance == null) {
        sInstance=new DBWorker(context.getApplicationContext());
        localInstance=sInstance;
      }
    }
  }
  return localInstance;
}

Fixed version (ground truth):
public static DBWorker getInstance(@NonNull Context context){
  DBWorker localInstance=sInstance;
  if (localInstance == null) {
synchronized (DBWorker.class) {
      localInstance=sInstance;
      if (localInstance == null) {
        sInstance=new DBWorker(context.getApplicationContext());
        localInstance=sInstance;
      }
    }
  }
  return localInstance;
}
Program: 146461
Project: 146461
Buggy source:
@Override public String getLabel(Crosshair crosshair,Plot plot,double v,double v2){
  int index=priceSeries.convertToArrayIndex(v);
  if (index < 0)   index=0;
  if (index >= 0) {
    if (index >= priceSeries.getPointCount())     index=priceSeries.getPointCount() - 1;
    return data.history.get(index).time.replace("String_Node_Str","String_Node_Str") + String.format("String_Node_Str",priceText) + PRICE_DECIMAL_FORMAT.format(v2)+ String.format("String_Node_Str",volumeText)+ String.valueOf((int)(data.history.get(index).volume + 0.5f));
  }
  return null;
}

Fixed version (ground truth):
@Override public String getLabel(Crosshair crosshair,Plot plot,double v,double v2){
  int index=priceSeries.convertToArrayIndex(v);
  if (index < 0) {
    index=0;
  }
  if (index >= 0) {
    if (index >= priceSeries.getPointCount()) {
      index=priceSeries.getPointCount() - 1;
    }
    return data.history.get(index).time.replace("String_Node_Str","String_Node_Str") + String.format("String_Node_Str",priceText) + PRICE_DECIMAL_FORMAT.format(v2)+ String.format("String_Node_Str",volumeText)+ String.valueOf((int)(data.history.get(index).volume + 0.5f));
  }
  return null;
}
Program: 146462
Project: 146462
Buggy source:
@Override public void updateChartData(){
  ConnectivityManager connectivityManager=(ConnectivityManager)getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
  NetworkInfo networkInfo=connectivityManager.getActiveNetworkInfo();
  if (networkInfo == null || !networkInfo.isConnected()) {
    Toast.makeText(getActivity(),R.string.no_connection_text,Toast.LENGTH_SHORT).show();
    return;
  }
  if (chartsMap.size() > 0) {
    List<String> chartNames=new ArrayList<>(chartsMap.keySet());
    Collections.sort(chartNames,PairUtils.CURRENCY_COMPARATOR);
    if (getActivity() != null) {
      isUpdating=true;
      getActivity().invalidateOptionsMenu();
    }
    for (    String pair : chartNames) {
      chartsUpdater.queueChart(chartsMap.get(pair),pair);
    }
  }
}

Fixed version (ground truth):
@Override public void updateChartData(){
  ConnectivityManager connectivityManager=(ConnectivityManager)getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
  NetworkInfo networkInfo=connectivityManager.getActiveNetworkInfo();
  if (networkInfo == null || !networkInfo.isConnected()) {
    Toast.makeText(getActivity(),R.string.no_connection_text,Toast.LENGTH_SHORT).show();
    return;
  }
  if (!chartsMap.isEmpty()) {
    List<String> chartNames=new ArrayList<>(chartsMap.keySet());
    Collections.sort(chartNames,PairUtils.CURRENCY_COMPARATOR);
    if (getActivity() != null) {
      isUpdating=true;
      getActivity().invalidateOptionsMenu();
    }
    for (    String pair : chartNames) {
      chartsUpdater.queueChart(chartsMap.get(pair),pair);
    }
  }
}