nus-yam/ex-repair huggingface dataset:
Program: 161528
Project: 161528
Buggy source:
/** 
 * Download cafeteria menus from external interface (JSON)
 * @param force True to force download over normal sync period, else false
 */
public void downloadFromExternal(Context context,boolean force) throws JSONException, IOException {
  if (!force && !SyncManager.needSync(db,this,TIME_TO_SYNC)) {
    return;
  }
  String url="String_Node_Str";
  Optional<JSONObject> json=NetUtils.downloadJson(context,url);
  if (!json.isPresent()) {
    return;
  }
  JSONObject obj=json.get();
  db.beginTransaction();
  removeCache();
  try {
    JSONArray menu=obj.getJSONArray("String_Node_Str");
    for (int j=0; j < menu.length(); j++) {
      replaceIntoDb(getFromJson(menu.getJSONObject(j)));
    }
    JSONArray beilagen=obj.getJSONArray("String_Node_Str");
    for (int j=0; j < beilagen.length(); j++) {
      replaceIntoDb(getFromJsonAddendum(beilagen.getJSONObject(j)));
    }
    db.setTransactionSuccessful();
  }
  finally {
    db.endTransaction();
  }
  SyncManager.replaceIntoDb(db,this);
}

Fixed version (ground truth):
/** 
 * Download cafeteria menus from external interface (JSON)
 * @param force True to force download over normal sync period, else false
 */
public void downloadFromExternal(Context context,boolean force) throws JSONException {
  if (!force && !SyncManager.needSync(db,this,TIME_TO_SYNC)) {
    return;
  }
  String url="String_Node_Str";
  Optional<JSONObject> json=NetUtils.downloadJson(context,url);
  if (!json.isPresent()) {
    return;
  }
  JSONObject obj=json.get();
  db.beginTransaction();
  removeCache();
  try {
    JSONArray menu=obj.getJSONArray("String_Node_Str");
    for (int j=0; j < menu.length(); j++) {
      replaceIntoDb(getFromJson(menu.getJSONObject(j)));
    }
    JSONArray beilagen=obj.getJSONArray("String_Node_Str");
    for (int j=0; j < beilagen.length(); j++) {
      replaceIntoDb(getFromJsonAddendum(beilagen.getJSONObject(j)));
    }
    db.setTransactionSuccessful();
  }
  finally {
    db.endTransaction();
  }
  SyncManager.replaceIntoDb(db,this);
}
Program: 161530
Project: 161530
Buggy source:
private boolean downloadNews(boolean force){
  try {
    NewsManager nm=new NewsManager(this);
    nm.downloadFromExternal(force);
    return true;
  }
 catch (  Exception e) {
    Utils.log(e);
    return false;
  }
}

Fixed version (ground truth):
private boolean downloadNews(boolean force){
  try {
    NewsManager nm=new NewsManager(this);
    nm.downloadFromExternal(force);
    return true;
  }
 catch (  JSONException e) {
    Utils.log(e);
    return false;
  }
}
Program: 161531
Project: 161531
Buggy source:
private boolean downloadStudyRooms(){
  try {
    StudyRoomGroupManager sm=new StudyRoomGroupManager(this);
    sm.downloadFromExternal();
    return true;
  }
 catch (  Exception e) {
    Utils.log(e);
    return false;
  }
}

Fixed version (ground truth):
private boolean downloadStudyRooms(){
  try {
    StudyRoomGroupManager sm=new StudyRoomGroupManager(this);
    sm.downloadFromExternal();
    return true;
  }
 catch (  JSONException e) {
    Utils.log(e);
    return false;
  }
}
Program: 161532
Project: 161532
Buggy source:
private boolean downloadCafeterias(boolean force){
  try {
    CafeteriaManager cm=new CafeteriaManager(this);
    CafeteriaMenuManager cmm=new CafeteriaMenuManager(this);
    cm.downloadFromExternal(force);
    cmm.downloadFromExternal(this,force);
    return true;
  }
 catch (  Exception e) {
    Utils.log(e);
    return false;
  }
}

Fixed version (ground truth):
private boolean downloadCafeterias(boolean force){
  try {
    CafeteriaManager cm=new CafeteriaManager(this);
    CafeteriaMenuManager cmm=new CafeteriaMenuManager(this);
    cm.downloadFromExternal(force);
    cmm.downloadFromExternal(this,force);
    return true;
  }
 catch (  JSONException e) {
    Utils.log(e);
    return false;
  }
}
Program: 161533
Project: 161533
Buggy source:
private boolean downLoadKino(boolean force){
  try {
    KinoManager km=new KinoManager(this);
    km.downloadFromExternal(force);
    return true;
  }
 catch (  Exception e) {
    Utils.log(e);
    return false;
  }
}

Fixed version (ground truth):
private boolean downLoadKino(boolean force){
  try {
    KinoManager km=new KinoManager(this);
    km.downloadFromExternal(force);
    return true;
  }
 catch (  JSONException e) {
    Utils.log(e);
    return false;
  }
}
Program: 161534
Project: 161534
Buggy source:
/** 
 * fetches the room coordinates
 * @param archId architecture id
 * @return coordinates of the room
 */
public Optional<Geo> fetchCoordinates(String archId){
  String url=API_URL_COORDINATES + encodeUrl(archId);
  Geo result=null;
  try {
    Optional<JSONObject> jsonObject=net.downloadJson(url);
    if (jsonObject.isPresent()) {
      double zone=jsonObject.get().getDouble(KEY_UTM_ZONE);
      double easting=jsonObject.get().getDouble(KEY_UTM_EASTING);
      double northing=jsonObject.get().getDouble(KEY_UTM_NORTHING);
      result=convertUTMtoLL(northing,easting,zone);
    }
  }
 catch (  IOException|JSONException e) {
    Utils.log(String.valueOf(e));
  }
  return Optional.fromNullable(result);
}

Fixed version (ground truth):
/** 
 * fetches the room coordinates
 * @param archId architecture id
 * @return coordinates of the room
 */
public Optional<Geo> fetchCoordinates(String archId){
  String url=API_URL_COORDINATES + encodeUrl(archId);
  Geo result=null;
  try {
    Optional<JSONObject> jsonObject=net.downloadJson(url);
    if (jsonObject.isPresent()) {
      double zone=jsonObject.get().getDouble(KEY_UTM_ZONE);
      double easting=jsonObject.get().getDouble(KEY_UTM_EASTING);
      double northing=jsonObject.get().getDouble(KEY_UTM_NORTHING);
      result=convertUTMtoLL(northing,easting,zone);
    }
  }
 catch (  JSONException e) {
    Utils.log(String.valueOf(e));
  }
  return Optional.fromNullable(result);
}
Program: 161535
Project: 161535
Buggy source:
private boolean checkSurveyData(){
  int numberOfQuestion=aSpinner1.getSelectedItemPosition() + 1;
  boolean done=true;
  for (int i=0; i < numberOfQuestion; i++) {
    EditText v=(EditText)questionsLayout.findViewWithTag("String_Node_Str" + (i + 1));
    if (hasQuestion(v)) {
      questions.add(v.getText().toString());
    }
 else {
      done=false;
      questions.clear();
      break;
    }
  }
  if (done) {
    newDate=getDateTime();
    chosenFaculties=getSelectedFaculties(selectedFaculties);
    return true;
  }
 else   Toast.makeText(getApplicationContext(),getResources().getString(R.string.complete_question_form),Toast.LENGTH_SHORT).show();
  return false;
}

Fixed version (ground truth):
private boolean checkSurveyData(){
  int numberOfQuestion=aSpinner1.getSelectedItemPosition() + 1;
  boolean done=true;
  for (int i=0; i < numberOfQuestion; i++) {
    EditText v=(EditText)questionsLayout.findViewWithTag("String_Node_Str" + (i + 1));
    if (hasQuestion(v)) {
      questions.add(v.getText().toString());
    }
 else {
      done=false;
      questions.clear();
      break;
    }
  }
  if (done) {
    newDate=getDateTime();
    chosenFaculties=getSelectedFaculties(selectedFaculties);
    return true;
  }
 else {
    Toast.makeText(getApplicationContext(),getResources().getString(R.string.complete_question_form),Toast.LENGTH_SHORT).show();
  }
  return false;
}
Program: 161537
Project: 161537
Buggy source:
@Override public void onTabChanged(String s){
  int currentTab=tabHost.getCurrentTab();
  Utils.log("String_Node_Str" + currentTab);
  if (currentTab == 0) {
    mainResponseLayout.removeAllViews();
  }
 else {
    if (NetUtils.isConnected(getApplication())) {
      new AsyncTask<Void,Void,Void>(){
        @Override protected Void doInBackground(        Void... voids){
          surveyManager.downLoadOwnQuestions();
          return null;
        }
        @Override protected void onPostExecute(        Void v){
          setUpResponseTab();
        }
      }
.execute();
    }
 else {
      setUpResponseTab();
    }
  }
}

Fixed version (ground truth):
@Override public void onTabChanged(String s){
  int currentTab=tabHost.getCurrentTab();
  if (currentTab == 0) {
    mainResponseLayout.removeAllViews();
  }
 else {
    if (NetUtils.isConnected(getApplication())) {
      new AsyncTask<Void,Void,Void>(){
        @Override protected Void doInBackground(        Void... voids){
          surveyManager.downLoadOwnQuestions();
          return null;
        }
        @Override protected void onPostExecute(        Void v){
          setUpResponseTab();
        }
      }
.execute();
    }
 else {
      setUpResponseTab();
    }
  }
}
Program: 161538
Project: 161538
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  surveyManager=new SurveyManager(this);
  super.onCreate(savedInstanceState);
  lrzId=Utils.getSetting(this,Const.LRZ_ID,"String_Node_Str");
  registerReceiver(connectivityChangeReceiver,new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
  if (NetUtils.isConnected(this)) {
    findViewsById();
    setUpTabHost();
    setUpSpinner();
    setUpSelectTargets();
    submitAndTabListeners();
    userAllowed();
    unregisterReceiver(connectivityChangeReceiver);
  }
 else   setContentView(R.layout.layout_no_internet);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  surveyManager=new SurveyManager(this);
  super.onCreate(savedInstanceState);
  lrzId=Utils.getSetting(this,Const.LRZ_ID,"String_Node_Str");
  registerReceiver(connectivityChangeReceiver,new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
  if (NetUtils.isConnected(this)) {
    findViewsById();
    setUpTabHost();
    setUpSpinner();
    setUpSelectTargets();
    submitAndTabListeners();
    userAllowed();
    unregisterReceiver(connectivityChangeReceiver);
  }
 else {
    setContentView(R.layout.layout_no_internet);
  }
}
Program: 161539
Project: 161539
Buggy source:
private void clearData(){
  selectedFaculties.clear();
  chosenFaculties="String_Node_Str";
  questions.clear();
  newDate="String_Node_Str";
  for (int i=0; i < checked.length; i++) {
    checked[i]=false;
  }
  aSpinner1.setSelection(0);
  questionsLayout.removeAllViews();
}

Fixed version (ground truth):
private void clearData(){
  selectedFaculties.clear();
  chosenFaculties="String_Node_Str";
  questions.clear();
  newDate="String_Node_Str";
  for (int i=0; i < checked.length; i++) {
    checked[i]=false;
  }
  aSpinner1.setSelection(0);
}
Program: 161540
Project: 161540
Buggy source:
@SuppressLint("String_Node_Str") private void userAllowed(){
  String weekAgo=getDateBefore1Week();
  Utils.log("String_Node_Str" + weekAgo);
  Cursor c=surveyManager.numberOfQuestionsFrom(weekAgo);
  if (c.getCount() > 0) {
    c.moveToFirst();
  }
  int x=c.getInt(0);
  if (x < 3) {
    numQues=new String[3 - x];
    for (int i=0; i < numQues.length; i++) {
      numQues[i]=String.valueOf(i + 1);
    }
    ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,numQues);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    aSpinner1.setAdapter(adapter);
    if (x == 2) {
      selectTv.setText(getResources().getString(R.string.one_question_left));
    }
  }
 else {
    String strDate=getNextPossibleDate();
    selectTv.setVisibility(View.VISIBLE);
    selectTv.setText(getResources().getString(R.string.next_possible_survey_date) + "String_Node_Str" + strDate);
    submitSurveyButton.setVisibility(View.GONE);
    questionsLayout.setVisibility(View.GONE);
    facultiesButton.setVisibility(View.GONE);
    aSpinner1.setVisibility(View.GONE);
  }
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") private void userAllowed(){
  String weekAgo=getDateBefore1Week();
  Utils.log("String_Node_Str" + weekAgo);
  Cursor c=surveyManager.numberOfQuestionsFrom(weekAgo);
  if (c.getCount() > 0) {
    c.moveToFirst();
  }
  int x=c.getInt(0);
  Utils.log("String_Node_Str" + x);
  if (x < 3) {
    numQues=new String[3 - x];
    for (int i=0; i < numQues.length; i++) {
      numQues[i]=String.valueOf(i + 1);
    }
    ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,numQues);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    aSpinner1.setAdapter(adapter);
    if (x == 2) {
      selectTv.setText(getResources().getString(R.string.one_question_left));
    }
  }
 else {
    String strDate=getNextPossibleDate();
    selectTv.setVisibility(View.VISIBLE);
    selectTv.setText(getResources().getString(R.string.next_possible_survey_date) + "String_Node_Str" + strDate);
    submitSurveyButton.setVisibility(View.GONE);
    questionsLayout.setVisibility(View.GONE);
    facultiesButton.setVisibility(View.GONE);
    aSpinner1.setVisibility(View.GONE);
  }
}
Program: 161543
Project: 161543
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  if (NetUtils.isConnected(context)) {
    restartActivity();
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  if (NetUtils.isConnected(getApplicationContext())) {
    restartActivity();
    unregisterReceiver(connectivityChangeReceiver);
  }
}
Program: 161545
Project: 161545
Buggy source:
@Override protected Boolean onLoadInBackground(Void... arg){
  ChatRoomManager manager=new ChatRoomManager(this);
  ChatMember member=Utils.getSetting(this,Const.CHAT_MEMBER,ChatMember.class);
  if (member == null)   return false;
  try {
    List<ChatRoom> rooms=TUMCabeClient.getInstance(this).getMemberRooms(member.getId(),new ChatVerification(this,member));
    manager.replaceIntoRooms(rooms);
    return true;
  }
 catch (  RetrofitError e) {
    Utils.log(e);
  }
catch (  NoPrivateKey e) {
    Utils.log(e);
  }
  return false;
}

Fixed version (ground truth):
@Override protected Boolean onLoadInBackground(Void... arg){
  ChatRoomManager manager=new ChatRoomManager(this);
  ChatMember member=Utils.getSetting(this,Const.CHAT_MEMBER,ChatMember.class);
  if (member == null)   return false;
  try {
    List<ChatRoom> rooms=TUMCabeClient.getInstance(this).getMemberRooms(member.getId(),new ChatVerification(this,member));
    manager.replaceIntoRooms(rooms);
    Utils.setInternalSetting(this,Const.PRIVATE_KEY_ACTIVE,true);
    return true;
  }
 catch (  RetrofitError e) {
    Utils.log(e);
  }
catch (  NoPrivateKey e) {
    Utils.log(e);
  }
  return false;
}
Program: 161546
Project: 161546
Buggy source:
/** 
 * Open next activity on skip
 * @param skip Skip button handle
 */
@SuppressWarnings("String_Node_Str") public void onClickSkip(View skip){
  startNextActivity();
}

Fixed version (ground truth):
/** 
 * Open next activity on skip
 * @param skip Skip button handle
 */
@SuppressWarnings("String_Node_Str") public void onClickSkip(View skip){
  startNextActivity(true);
}
Program: 161547
Project: 161547
Buggy source:
@Override protected void onLoadFinished(ChatMember member){
  if (member != null) {
    Utils.setSetting(this,Const.GROUP_CHAT_ENABLED,groupChatMode.isChecked());
    Utils.setSetting(this,Const.AUTO_JOIN_NEW_ROOMS,groupChatMode.isChecked() && autoJoin.isChecked());
    Utils.setSetting(this,Const.CHAT_MEMBER,member);
    Utils.log("String_Node_Str" + new Gson().toJson(member));
    startNextActivity();
  }
 else {
    showLoadingEnded();
  }
}

Fixed version (ground truth):
@Override protected void onLoadFinished(ChatMember member){
  if (member != null) {
    Utils.setSetting(this,Const.GROUP_CHAT_ENABLED,groupChatMode.isChecked());
    Utils.setSetting(this,Const.AUTO_JOIN_NEW_ROOMS,groupChatMode.isChecked() && autoJoin.isChecked());
    Utils.setSetting(this,Const.CHAT_MEMBER,member);
    Utils.log("String_Node_Str" + new Gson().toJson(member));
    startNextActivity(false);
  }
 else {
    showLoadingEnded();
  }
}
Program: 161548
Project: 161548
Buggy source:
/** 
 * Opens next wizard page
 */
private void startNextActivity(){
  finish();
  Intent intent;
  if (!Utils.getInternalSettingBool(this,Const.PRIVATE_KEY_ACTIVE,false)) {
    intent=new Intent(this,WizNavActivatePublicKeyActivity.class);
  }
 else {
    intent=new Intent(this,WizNavExtrasActivity.class);
  }
  intent.putExtra(Const.TOKEN_IS_SETUP,tokenSetup);
  startActivity(intent);
  overridePendingTransition(R.anim.fadein,R.anim.fadeout);
}

Fixed version (ground truth):
/** 
 * Opens next wizard page
 */
private void startNextActivity(boolean skip){
  finish();
  Intent intent;
  if (skip) {
    intent=new Intent(this,WizNavExtrasActivity.class);
  }
 else {
    if (!Utils.getInternalSettingBool(this,Const.PRIVATE_KEY_ACTIVE,false)) {
      intent=new Intent(this,WizNavActivatePublicKeyActivity.class);
    }
 else {
      intent=new Intent(this,WizNavExtrasActivity.class);
    }
  }
  intent.putExtra(Const.TOKEN_IS_SETUP,tokenSetup);
  startActivity(intent);
  overridePendingTransition(R.anim.fadein,R.anim.fadeout);
}
Program: 161549
Project: 161549
Buggy source:
@Override public void onItemSelected(AdapterView<?> adapterView,View view,int i,long l){
  SurveyManager sm=new SurveyManager(getApplicationContext());
  Cursor c=sm.getFacultyID((String)adapterView.getItemAtPosition(i));
  if (c.moveToFirst()) {
    Utils.setInternalSetting(getApplicationContext(),"String_Node_Str",c.getString(c.getColumnIndex("String_Node_Str")));
  }
  TextView selectedItem=(TextView)adapterView.getChildAt(0);
  if (selectedItem != null) {
    selectedItem.setTextColor(ContextCompat.getColor(getApplicationContext(),R.color.color_primary));
  }
  userMajor=(String)adapterView.getItemAtPosition(i);
}

Fixed version (ground truth):
@Override public void onItemSelected(AdapterView<?> adapterView,View view,int i,long l){
  SurveyManager sm=new SurveyManager(getApplicationContext());
  Cursor c=sm.getFacultyID((String)adapterView.getItemAtPosition(i));
  if (c.moveToFirst()) {
    Utils.setInternalSetting(getApplicationContext(),"String_Node_Str",c.getString(c.getColumnIndex("String_Node_Str")));
  }
  TextView selectedItem=(TextView)adapterView.getChildAt(0);
  if (selectedItem != null) {
    selectedItem.setTextColor(ContextCompat.getColor(getApplicationContext(),R.color.color_primary));
  }
}
Program: 161550
Project: 161550
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  disableRefresh();
  sharedPrefs=PreferenceManager.getDefaultSharedPreferences(this);
  LinearLayout layout=(LinearLayout)findViewById(R.id.wizard_start_layout);
  layout.requestFocus();
  userMajorSpinner=(Spinner)findViewById(R.id.majorSpinner);
  editText=(EditText)findViewById(R.id.lrd_id);
  setUpSpinner();
  lrzId=sharedPrefs.getString(Const.LRZ_ID,"String_Node_Str");
  if (lrzId != null) {
    editText.setText(lrzId);
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  disableRefresh();
  sharedPrefs=PreferenceManager.getDefaultSharedPreferences(this);
  LinearLayout layout=(LinearLayout)findViewById(R.id.wizard_start_layout);
  layout.requestFocus();
  userMajorSpinner=(Spinner)findViewById(R.id.majorSpinner);
  setUpSpinner();
  editTxtLrzId=(EditText)findViewById(R.id.lrd_id);
  lrzId=sharedPrefs.getString(Const.LRZ_ID,"String_Node_Str");
  if (lrzId != null) {
    editTxtLrzId.setText(lrzId);
  }
}
Program: 161551
Project: 161551
Buggy source:
/** 
 * Handle click in dialog buttons
 * @param dialog Dialog handle
 * @param which Button clicked
 */
@Override public void onClick(DialogInterface dialog,int which){
  if (which == DialogInterface.BUTTON_POSITIVE) {
    startLoading();
  }
 else   if (which == DialogInterface.BUTTON_NEGATIVE) {
    onLoadFinished(true);
  }
}

Fixed version (ground truth):
/** 
 * Handle click in dialog buttons
 * @param dialog Dialog handle
 * @param which  Button clicked
 */
@Override public void onClick(DialogInterface dialog,int which){
  if (which == DialogInterface.BUTTON_POSITIVE) {
    startLoading();
  }
 else   if (which == DialogInterface.BUTTON_NEGATIVE) {
    onLoadFinished(true);
  }
}
Program: 161553
Project: 161553
Buggy source:
@Override protected void onPostExecute(String[] majors){
  ArrayAdapter<String> adapter=new ArrayAdapter<String>(getBaseContext(),android.R.layout.simple_list_item_1,majors);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  userMajorSpinner.setAdapter(adapter);
  userMajorSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> adapterView,    View view,    int i,    long l){
      SurveyManager sm=new SurveyManager(getApplicationContext());
      Cursor c=sm.getFacultyID((String)adapterView.getItemAtPosition(i));
      if (c.moveToFirst()) {
        Utils.setInternalSetting(getApplicationContext(),"String_Node_Str",c.getString(c.getColumnIndex("String_Node_Str")));
      }
      TextView selectedItem=(TextView)adapterView.getChildAt(0);
      if (selectedItem != null) {
        selectedItem.setTextColor(ContextCompat.getColor(getApplicationContext(),R.color.color_primary));
      }
      userMajor=(String)adapterView.getItemAtPosition(i);
    }
    @Override public void onNothingSelected(    AdapterView<?> adapterView){
    }
  }
);
  return;
}

Fixed version (ground truth):
@Override protected void onPostExecute(String[] majors){
  ArrayAdapter<String> adapter=new ArrayAdapter<String>(getBaseContext(),android.R.layout.simple_list_item_1,majors);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  userMajorSpinner.setAdapter(adapter);
  userMajorSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> adapterView,    View view,    int i,    long l){
      SurveyManager sm=new SurveyManager(getApplicationContext());
      Cursor c=sm.getFacultyID((String)adapterView.getItemAtPosition(i));
      if (c.moveToFirst()) {
        Utils.setInternalSetting(getApplicationContext(),"String_Node_Str",c.getString(c.getColumnIndex("String_Node_Str")));
      }
      TextView selectedItem=(TextView)adapterView.getChildAt(0);
      if (selectedItem != null) {
        selectedItem.setTextColor(ContextCompat.getColor(getApplicationContext(),R.color.color_primary));
      }
    }
    @Override public void onNothingSelected(    AdapterView<?> adapterView){
    }
  }
);
  return;
}
Program: 161554
Project: 161554
Buggy source:
/** 
 * Handle click on next button
 * @param next Next button handle
 */
@SuppressWarnings("String_Node_Str") public void onClickNext(View next){
  if (userMajorSpinner.getSelectedItemPosition() == 0) {
    Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    return;
  }
  userMajor=userMajorSpinner.getSelectedItem().toString();
  lrzId=editText.getText().toString();
  Editor editor=sharedPrefs.edit();
  editor.putString(Const.LRZ_ID,lrzId);
  editor.apply();
  if (lrzId.length() >= AccessTokenManager.MIN_LRZ_LENGTH) {
    if (accessTokenManager.hasValidAccessToken()) {
      new AlertDialog.Builder(this).setMessage(getString(R.string.dialog_new_token)).setPositiveButton(getString(R.string.yes),this).setNegativeButton(getString(R.string.no),this).show();
    }
 else {
      startLoading();
    }
  }
 else {
    Utils.showToast(this,R.string.error_lrz_wrong);
  }
}

Fixed version (ground truth):
/** 
 * Handle click on next button
 * @param next Next button handle
 */
@SuppressWarnings("String_Node_Str") public void onClickNext(View next){
  if (userMajorSpinner.getSelectedItemPosition() == 0) {
    Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    return;
  }
  lrzId=editTxtLrzId.getText().toString();
  Editor editor=sharedPrefs.edit();
  editor.putString(Const.LRZ_ID,lrzId);
  editor.apply();
  if (lrzId.length() >= AccessTokenManager.MIN_LRZ_LENGTH) {
    if (accessTokenManager.hasValidAccessToken()) {
      new AlertDialog.Builder(this).setMessage(getString(R.string.dialog_new_token)).setPositiveButton(getString(R.string.yes),this).setNegativeButton(getString(R.string.no),this).show();
    }
 else {
      startLoading();
    }
  }
 else {
    Utils.showToast(this,R.string.error_lrz_wrong);
  }
}
Program: 161555
Project: 161555
Buggy source:
private String getDateTime(){
  Calendar c=Calendar.getInstance();
  SimpleDateFormat sdf=new SimpleDateFormat("String_Node_Str");
  String strDate=sdf.format(c.getTime());
  return strDate;
}

Fixed version (ground truth):
private String getDateTime(){
  Calendar c=Calendar.getInstance();
  SimpleDateFormat sdf=new SimpleDateFormat("String_Node_Str");
  return sdf.format(c.getTime());
}
Program: 161556
Project: 161556
Buggy source:
/** 
 * This method populates the data for lists which will be shown on this activity. It is called by Moodlemanager when the requested data is ready. In this case after requesting requestUserData() after the first login or requestUserCourseList()
 */
public void refresh(){
  try {
    if (!NetUtils.isConnected(this)) {
      Utils.showToast(this,R.string.no_internet_connection);
      showNoInternetLayout();
      return;
    }
    emptyListViewData();
    Map<String,String> courses=(Map<String,String>)realManager.getCoursesList();
    if (realManager.getMoodleUserInfo() == null) {
      Utils.log("String_Node_Str");
      Intent intent=new Intent(this,MoodleLoginActivity.class);
      intent.putExtra("String_Node_Str",this.getClass());
      intent.putExtra("String_Node_Str",false);
      startActivity(intent);
      finish();
      return;
    }
    if (courses == null) {
      realManager.requestUserCourseList(this);
      return;
    }
 else {
      coursesIds=(Map<String,Integer>)realManager.getCoursesId();
      for (      Map.Entry<String,String> item : courses.entrySet()) {
        List<String> temp=new ArrayList<String>();
        temp.add(item.getValue());
        courseListChilds.put(item.getKey(),temp);
        courseListHeaders.add(item.getKey());
      }
      baseSetupForListView();
      showLoadingEnded();
      coursesAdapter.notifyDataSetChanged();
    }
  }
 catch (  Exception e) {
    Utils.log(e);
    showLoadingEnded();
    Utils.showToast(this,R.string.error_something_wrong);
  }
}

Fixed version (ground truth):
/** 
 * This method populates the data for lists which will be shown on this activity. It is called by Moodlemanager when the requested data is ready. In this case after requesting requestUserData() after the first login or requestUserCourseList()
 */
public void refresh(){
  try {
    if (!NetUtils.isConnected(this)) {
      Utils.showToast(this,R.string.no_internet_connection);
      showNoInternetLayout();
      return;
    }
    emptyListViewData();
    Map<String,String> courses=realManager.getCoursesList();
    if (realManager.getMoodleUserInfo() == null) {
      Utils.log("String_Node_Str");
      Intent intent=new Intent(this,MoodleLoginActivity.class);
      intent.putExtra("String_Node_Str",this.getClass());
      intent.putExtra("String_Node_Str",false);
      startActivity(intent);
      finish();
      return;
    }
    if (courses == null) {
      realManager.requestUserCourseList(this);
      return;
    }
 else {
      coursesIds=realManager.getCoursesId();
      for (      Map.Entry<String,String> item : courses.entrySet()) {
        List<String> temp=new ArrayList<String>();
        temp.add(item.getValue());
        courseListChilds.put(item.getKey(),temp);
        courseListHeaders.add(item.getKey());
      }
      baseSetupForListView();
      showLoadingEnded();
      coursesAdapter.notifyDataSetChanged();
    }
  }
 catch (  Exception e) {
    Utils.log(e);
    showLoadingEnded();
    Utils.showToast(this,R.string.error_something_wrong);
  }
}
Program: 161557
Project: 161557
Buggy source:
/** 
 * Checks if play services are available and registers for GCM
 */
private boolean checkPlayServicesAndRegister(){
  if (GcmIdentificationService.checkPlayServices(this)) {
    GcmIdentificationService idService=new GcmIdentificationService();
    idService.checkSetup();
    return true;
  }
 else {
    Utils.log("String_Node_Str");
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Checks if play services are available and registers for GCM
 */
private boolean checkPlayServicesAndRegister(){
  if (GcmIdentificationService.checkPlayServices(this)) {
    GcmIdentificationService idService=new GcmIdentificationService(this);
    idService.checkSetup();
    return true;
  }
 else {
    Utils.log("String_Node_Str");
    return false;
  }
}
Program: 161558
Project: 161558
Buggy source:
public String getCurrentToken(){
  return Utils.getInternalSettingString(this,Const.GCM_TOKEN_ID,"String_Node_Str");
}

Fixed version (ground truth):
public String getCurrentToken(){
  return Utils.getInternalSettingString(this.mContext,Const.GCM_TOKEN_ID,"String_Node_Str");
}
Program: 161559
Project: 161559
Buggy source:
@Override protected String doInBackground(Void... params){
  try {
    String regId=GcmIdentificationService.this.register();
    Utils.setInternalSetting(GcmIdentificationService.this,Const.GCM_REG_ID_SENT_TO_SERVER,false);
    Utils.setInternalSetting(GcmIdentificationService.this,Const.GCM_REG_ID_LAST_TRANSMISSION,(new Date()).getTime());
    GcmIdentificationService.this.sendRegistrationIdToBackend(regId);
    return "String_Node_Str";
  }
 catch (  IOException ex) {
    return "String_Node_Str" + ex.getMessage();
  }
}

Fixed version (ground truth):
@Override protected String doInBackground(Void... params){
  try {
    String regId=GcmIdentificationService.this.register();
    Utils.setInternalSetting(mContext,Const.GCM_REG_ID_SENT_TO_SERVER,false);
    Utils.setInternalSetting(mContext,Const.GCM_REG_ID_LAST_TRANSMISSION,(new Date()).getTime());
    GcmIdentificationService.this.sendRegistrationIdToBackend(regId);
    return "String_Node_Str";
  }
 catch (  IOException ex) {
    return "String_Node_Str" + ex.getMessage();
  }
}
Program: 161560
Project: 161560
Buggy source:
/** 
 * Helper function to check if we need to update the regid
 * @param regId registration ID
 */
private void checkRegisterIdUpdate(String regId){
  long lastTransmission=Utils.getInternalSettingLong(this,Const.GCM_REG_ID_LAST_TRANSMISSION,0);
  Date now=new Date();
  if (now.getTime() - 24 * 3600000 > lastTransmission) {
    this.sendRegistrationIdToBackend(regId);
  }
}

Fixed version (ground truth):
/** 
 * Helper function to check if we need to update the regid
 * @param regId registration ID
 */
private void checkRegisterIdUpdate(String regId){
  long lastTransmission=Utils.getInternalSettingLong(mContext,Const.GCM_REG_ID_LAST_TRANSMISSION,0);
  Date now=new Date();
  if (now.getTime() - 24 * 3600000 > lastTransmission) {
    this.sendRegistrationIdToBackend(regId);
  }
}
Program: 161561
Project: 161561
Buggy source:
public void unregister() throws IOException {
  InstanceID.getInstance(this).deleteInstanceID();
  Utils.setInternalSetting(this,Const.GCM_INSTANCE_ID,"String_Node_Str");
  Utils.setInternalSetting(this,Const.GCM_TOKEN_ID,"String_Node_Str");
}

Fixed version (ground truth):
public void unregister() throws IOException {
  InstanceID.getInstance(mContext).deleteInstanceID();
  Utils.setInternalSetting(mContext,Const.GCM_INSTANCE_ID,"String_Node_Str");
  Utils.setInternalSetting(mContext,Const.GCM_TOKEN_ID,"String_Node_Str");
}
Program: 161562
Project: 161562
Buggy source:
/** 
 * Registers the application with GCM servers asynchronously. <p/> Stores the registration ID and app versionCode in the application's shared preferences.
 */
private void registerInBackground(){
  new AsyncTask<Void,Void,String>(){
    @Override protected String doInBackground(    Void... params){
      try {
        String regId=GcmIdentificationService.this.register();
        Utils.setInternalSetting(GcmIdentificationService.this,Const.GCM_REG_ID_SENT_TO_SERVER,false);
        Utils.setInternalSetting(GcmIdentificationService.this,Const.GCM_REG_ID_LAST_TRANSMISSION,(new Date()).getTime());
        GcmIdentificationService.this.sendRegistrationIdToBackend(regId);
        return "String_Node_Str";
      }
 catch (      IOException ex) {
        return "String_Node_Str" + ex.getMessage();
      }
    }
    @Override protected void onPostExecute(    String msg){
      Utils.log(msg);
    }
  }
.execute();
}

Fixed version (ground truth):
/** 
 * Registers the application with GCM servers asynchronously. <p/> Stores the registration ID and app versionCode in the application's shared preferences.
 */
private void registerInBackground(){
  new AsyncTask<Void,Void,String>(){
    @Override protected String doInBackground(    Void... params){
      try {
        String regId=GcmIdentificationService.this.register();
        Utils.setInternalSetting(mContext,Const.GCM_REG_ID_SENT_TO_SERVER,false);
        Utils.setInternalSetting(mContext,Const.GCM_REG_ID_LAST_TRANSMISSION,(new Date()).getTime());
        GcmIdentificationService.this.sendRegistrationIdToBackend(regId);
        return "String_Node_Str";
      }
 catch (      IOException ex) {
        return "String_Node_Str" + ex.getMessage();
      }
    }
    @Override protected void onPostExecute(    String msg){
      Utils.log(msg);
    }
  }
.execute();
}
Program: 161563
Project: 161563
Buggy source:
public void checkSetup(){
  String regId=this.getCurrentToken();
  if (regId.isEmpty()) {
    this.registerInBackground();
  }
 else {
    if (!Utils.getInternalSettingBool(this,Const.GCM_REG_ID_SENT_TO_SERVER,false)) {
      this.sendRegistrationIdToBackend(regId);
    }
    this.checkRegisterIdUpdate(regId);
  }
}

Fixed version (ground truth):
public void checkSetup(){
  String regId=this.getCurrentToken();
  if (regId.isEmpty()) {
    this.registerInBackground();
  }
 else {
    if (!Utils.getInternalSettingBool(mContext,Const.GCM_REG_ID_SENT_TO_SERVER,false)) {
      this.sendRegistrationIdToBackend(regId);
    }
    this.checkRegisterIdUpdate(regId);
  }
}
Program: 161564
Project: 161564
Buggy source:
/** 
 * Registers this phone with InstanceID and returns a valid token to be transmitted to the server
 * @return String token that can be used to transmit messages to this client
 */
public String register() throws IOException {
  String iid=InstanceID.getInstance(this).getId();
  String token=InstanceID.getInstance(this).getToken(senderId,GoogleCloudMessaging.INSTANCE_ID_SCOPE);
  Utils.setInternalSetting(this,Const.GCM_INSTANCE_ID,iid);
  Utils.setInternalSetting(this,Const.GCM_TOKEN_ID,token);
  return token;
}

Fixed version (ground truth):
/** 
 * Registers this phone with InstanceID and returns a valid token to be transmitted to the server
 * @return String token that can be used to transmit messages to this client
 */
public String register() throws IOException {
  String iid=InstanceID.getInstance(mContext).getId();
  String token=InstanceID.getInstance(mContext).getToken(senderId,GoogleCloudMessaging.INSTANCE_ID_SCOPE);
  Utils.setInternalSetting(mContext,Const.GCM_INSTANCE_ID,iid);
  Utils.setInternalSetting(mContext,Const.GCM_TOKEN_ID,token);
  return token;
}
Program: 161565
Project: 161565
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  view.setBackgroundColor(ContextCompat.getColor(getContext(),R.color.background_material_light));
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  view.setBackgroundColor(Color.WHITE);
}
Program: 161566
Project: 161566
Buggy source:
@Override public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  @SuppressWarnings("String_Node_Str") HashMap<String,String> room=(HashMap<String,String>)list.getAdapter().getItem(position);
  String val="String_Node_Str";
  Bundle b=new Bundle();
  for (  Map.Entry<String,String> entry : room.entrySet()) {
    val+=entry.getKey() + "String_Node_Str" + entry.getValue()+ "String_Node_Str";
    b.putString(entry.getKey(),entry.getValue());
  }
  recentsManager.replaceIntoDb(val);
  Intent intent=new Intent(this,RoomFinderDetailsActivity.class);
  intent.putExtra(RoomFinderDetailsActivity.EXTRA_ROOM_INFO,b);
  startActivity(intent);
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  @SuppressWarnings("String_Node_Str") TreeMap<String,String> room=new TreeMap((HashMap<String,String>)list.getAdapter().getItem(position));
  String val="String_Node_Str";
  Bundle b=new Bundle();
  for (  Map.Entry<String,String> entry : room.entrySet()) {
    val+=entry.getKey() + "String_Node_Str" + entry.getValue()+ "String_Node_Str";
    b.putString(entry.getKey(),entry.getValue());
  }
  recentsManager.replaceIntoDb(val);
  Intent intent=new Intent(this,RoomFinderDetailsActivity.class);
  intent.putExtra(RoomFinderDetailsActivity.EXTRA_ROOM_INFO,b);
  startActivity(intent);
}
Program: 161567
Project: 161567
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  GCMChat extras=(GCMChat)intent.getSerializableExtra("String_Node_Str");
  Utils.log("String_Node_Str" + extras.room + "String_Node_Str"+ extras.member);
  if (extras.room == currentChatRoom.getId() && chatHistoryAdapter != null) {
    if (extras.member == currentChatMember.getId()) {
      chatHistoryAdapter.setUnsentMessages(chatManager.getAllUnsent());
    }
 else     if (extras.message == -1) {
      AudioManager am=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
      if (am.getRingerMode() == AudioManager.RINGER_MODE_NORMAL) {
        MediaPlayer mediaPlayer=MediaPlayer.create(ChatActivity.this,R.raw.message);
        mediaPlayer.start();
      }
 else       if (am.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE) {
        Vibrator v=(Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
        v.vibrate(500);
      }
    }
    chatHistoryAdapter.changeCursor(chatManager.getAll());
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  GCMChat extras=(GCMChat)intent.getSerializableExtra("String_Node_Str");
  if (extras == null) {
    return;
  }
  Utils.log("String_Node_Str" + extras.room + "String_Node_Str"+ extras.member);
  if (extras.room == currentChatRoom.getId() && chatHistoryAdapter != null) {
    if (extras.member == currentChatMember.getId()) {
      chatHistoryAdapter.setUnsentMessages(chatManager.getAllUnsent());
    }
 else     if (extras.message == -1) {
      AudioManager am=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
      if (am.getRingerMode() == AudioManager.RINGER_MODE_NORMAL) {
        MediaPlayer mediaPlayer=MediaPlayer.create(ChatActivity.this,R.raw.message);
        mediaPlayer.start();
      }
 else       if (am.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE) {
        Vibrator v=(Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
        v.vibrate(500);
      }
    }
    chatHistoryAdapter.changeCursor(chatManager.getAll());
  }
}
Program: 161568
Project: 161568
Buggy source:
@Override public void onClick(View v){
  mAdapter.insert(lastPos,card);
}

Fixed version (ground truth):
@Override public void onClick(View v){
  mAdapter.insert(lastPos,card);
  mCardsView.scrollToPosition(lastPos);
}
Program: 161569
Project: 161569
Buggy source:
/** 
 * Executed when the RestoreCard is pressed
 */
public void restoreCards(View view){
  CardManager.restoreCards();
  refreshCards();
}

Fixed version (ground truth):
/** 
 * Executed when the RestoreCard is pressed
 */
public void restoreCards(View view){
  CardManager.restoreCards();
  refreshCards();
  mCardsView.scrollToPosition(0);
}
Program: 161570
Project: 161570
Buggy source:
@Override public void onSwiped(RecyclerView.ViewHolder viewHolder,int direction){
  Card.CardViewHolder cardViewHolder=(Card.CardViewHolder)viewHolder;
  final Card card=cardViewHolder.getCurrentCard();
  final int lastPos=mAdapter.remove(card);
  final View coordinatorLayoutView=findViewById(R.id.snackbarPosition);
  Snackbar.make(coordinatorLayoutView,R.string.card_dismissed,Snackbar.LENGTH_LONG).setAction(R.string.undo,new View.OnClickListener(){
    @Override public void onClick(    View v){
      mAdapter.insert(lastPos,card);
    }
  }
).show();
}

Fixed version (ground truth):
@Override public void onSwiped(RecyclerView.ViewHolder viewHolder,int direction){
  Card.CardViewHolder cardViewHolder=(Card.CardViewHolder)viewHolder;
  final Card card=cardViewHolder.getCurrentCard();
  final int lastPos=mAdapter.remove(card);
  final View coordinatorLayoutView=findViewById(R.id.snackbarPosition);
  Snackbar.make(coordinatorLayoutView,R.string.card_dismissed,Snackbar.LENGTH_LONG).setAction(R.string.undo,new View.OnClickListener(){
    @Override public void onClick(    View v){
      mAdapter.insert(lastPos,card);
      mCardsView.scrollToPosition(lastPos);
    }
  }
).setCallback(new Snackbar.Callback(){
    @Override public void onDismissed(    Snackbar snackbar,    int event){
      super.onDismissed(snackbar,event);
      if (event != Snackbar.Callback.DISMISS_EVENT_ACTION) {
        card.discardCard();
      }
    }
  }
).show();
}
Program: 161571
Project: 161571
Buggy source:
@Override protected void onPostExecute(Void result){
  super.onPostExecute(result);
  if (mAdapter == null)   initAdapter();
 else   mAdapter.notifyDataSetChanged();
  mSwipeRefreshlayout.setRefreshing(false);
  if (!registered && !NetUtils.isConnected(MainActivity.this)) {
    registerReceiver(connectivityChangeReceiver,new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
    registered=true;
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(Void result){
  super.onPostExecute(result);
  if (mAdapter == null)   initAdapter();
 else {
    mAdapter.notifyItemRangeChanged(0,mAdapter.getItemCount());
  }
  mSwipeRefreshlayout.setRefreshing(false);
  if (!registered && !NetUtils.isConnected(MainActivity.this)) {
    registerReceiver(connectivityChangeReceiver,new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
    registered=true;
  }
}
Program: 161572
Project: 161572
Buggy source:
/** 
 * Starts updating cards in background Called when   {@link SwipeRefreshLayout} gets triggered.
 */
@Override public void onRefresh(){
  new AsyncTask<Void,Void,Void>(){
    @Override protected void onPreExecute(){
      super.onPreExecute();
    }
    @Override protected Void doInBackground(    Void... params){
      CardManager.update(MainActivity.this);
      return null;
    }
    @Override protected void onPostExecute(    Void result){
      super.onPostExecute(result);
      if (mAdapter == null)       initAdapter();
 else       mAdapter.notifyDataSetChanged();
      mSwipeRefreshlayout.setRefreshing(false);
      if (!registered && !NetUtils.isConnected(MainActivity.this)) {
        registerReceiver(connectivityChangeReceiver,new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
        registered=true;
      }
    }
  }
.execute();
}

Fixed version (ground truth):
/** 
 * Starts updating cards in background Called when   {@link SwipeRefreshLayout} gets triggered.
 */
@Override public void onRefresh(){
  new AsyncTask<Void,Void,Void>(){
    @Override protected void onPreExecute(){
      super.onPreExecute();
    }
    @Override protected Void doInBackground(    Void... params){
      CardManager.update(MainActivity.this);
      return null;
    }
    @Override protected void onPostExecute(    Void result){
      super.onPostExecute(result);
      if (mAdapter == null)       initAdapter();
 else {
        mAdapter.notifyItemRangeChanged(0,mAdapter.getItemCount());
      }
      mSwipeRefreshlayout.setRefreshing(false);
      if (!registered && !NetUtils.isConnected(MainActivity.this)) {
        registerReceiver(connectivityChangeReceiver,new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
        registered=true;
      }
    }
  }
.execute();
}
Program: 161573
Project: 161573
Buggy source:
/** 
 * Translates room title to Geo HINT: Don't call from UI thread
 * @param loc Room title
 * @return Location or null on failure
 */
public Geo roomLocationStringToGeo(String loc){
  TUMRoomFinderRequest requestHandler=new TUMRoomFinderRequest();
  if (loc.contains("String_Node_Str"))   loc=loc.substring(0,loc.indexOf('(')).trim();
  ArrayList<HashMap<String,String>> request=requestHandler.fetchRooms(loc);
  if (request.size() > 0) {
    String room=request.get(0).get(TUMRoomFinderRequest.KEY_ARCHITECT_NUMBER);
    return requestHandler.fetchCoordinates(room);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Translates room title to Geo HINT: Don't call from UI thread
 * @param loc Room title
 * @return Location or null on failure
 */
public Geo roomLocationStringToGeo(String loc){
  TUMRoomFinderRequest requestHandler=new TUMRoomFinderRequest(mContext);
  if (loc.contains("String_Node_Str"))   loc=loc.substring(0,loc.indexOf('(')).trim();
  ArrayList<HashMap<String,String>> request=requestHandler.fetchRooms(loc);
  if (request.size() > 0) {
    String room=request.get(0).get(TUMRoomFinderRequest.KEY_ARCHITECT_NUMBER);
    return requestHandler.fetchCoordinates(room);
  }
  return null;
}
Program: 161574
Project: 161574
Buggy source:
@Override protected void onStartSearch(String query){
  Utils.log("String_Node_Str" + query);
  if (!NetUtils.isConnected(this)) {
    showNoInternetLayout();
    return;
  }
  showLoadingStart();
  (new MVVJsoupParser(this)).execute(new String[]{query});
}

Fixed version (ground truth):
@Override protected void onStartSearch(String query){
  if (!NetUtils.isConnected(this)) {
    showNoInternetLayout();
    return;
  }
  showLoadingStart();
  (new MVVJsoupParser(this)).execute(new String[]{query});
}
Program: 161575
Project: 161575
Buggy source:
@Override public void showDepartureList(MVVObject dep){
  try {
    recentsManager.replaceIntoDb(dep.getDepartureHeader().trim());
    String stationHeader=dep.getDepartureHeader().trim() + "String_Node_Str" + dep.getDepartureServerTime()+ "String_Node_Str";
    listHeader.setText(stationHeader);
    listHeader.setTypeface(null,Typeface.BOLD);
    dataAdapter=new MvvAdapter(dep,this,this);
    departurelist.setAdapter(dataAdapter);
    showLoadingEnded();
  }
 catch (  Exception e) {
    Utils.log(e);
    Utils.showToast(this,"String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void showDepartureList(MVVObject dep){
  try {
    recentsManager.replaceIntoDb(dep.getDepartureHeader().trim());
    SharedPreferences sharedPreferences=getSharedPreferences(getString(R.string.mvv_shared_pref_key),MODE_PRIVATE);
    SharedPreferences.Editor editor=sharedPreferences.edit();
    editor.remove(getString(R.string.most_recent_station));
    editor.commit();
    editor.putString(getString(R.string.most_recent_station),dep.getDepartureHeader().trim());
    editor.commit();
    Utils.log("String_Node_Str" + dep.getDepartureHeader().trim());
    String stationHeader=dep.getDepartureHeader().trim() + "String_Node_Str" + dep.getDepartureServerTime()+ "String_Node_Str";
    listHeader.setText(stationHeader);
    listHeader.setTypeface(null,Typeface.BOLD);
    dataAdapter=new MvvAdapter(dep,this,this);
    departurelist.setAdapter(dataAdapter);
    showLoadingEnded();
  }
 catch (  Exception e) {
    Utils.log(e);
    Utils.showToast(this,"String_Node_Str");
  }
}
Program: 161576
Project: 161576
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  super.onReceive(context,intent);
  if (SYNC_CLICKED.equals(intent.getAction())) {
    if (!MVVWidgetService.loadRecentData())     Utils.showToast(context,"String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  super.onReceive(context,intent);
  if (Const.SYNC_CLICKED.equals(intent.getAction())) {
    if (!MVVWidgetService.loadRecentData())     Utils.showToast(context,"String_Node_Str");
  }
}