nus-yam/ex-repair huggingface dataset:
Program: 142000
Project: 142000
Buggy source:
protected static String buildDomainUser(String username){
  if (username != null && CommCareApplication.instance().getCurrentApp() != null) {
    SharedPreferences prefs=CommCareApplication.instance().getCurrentApp().getAppPreferences();
    if (prefs.contains(USER_DOMAIN_SUFFIX)) {
      username+="String_Node_Str" + prefs.getString(USER_DOMAIN_SUFFIX,null);
    }
  }
  return username;
}

Fixed version (ground truth):
protected static String buildDomainUser(String username){
  if (username != null && !username.contains("String_Node_Str")) {
    SharedPreferences prefs=CommCareApplication.instance().getCurrentApp().getAppPreferences();
    if (prefs.contains(USER_DOMAIN_SUFFIX)) {
      username+="String_Node_Str" + prefs.getString(USER_DOMAIN_SUFFIX,null);
    }
  }
  return username;
}
Program: 142001
Project: 142001
Buggy source:
private URL getURLToTry(){
  if (!requestedFromProd) {
    urlCurrentlyRequestingFrom=PROD_URL;
  }
 else   if (!requestedFromIndia) {
    urlCurrentlyRequestingFrom=INDIA_URL;
  }
 else {
    return null;
  }
  try {
    return new URL(urlCurrentlyRequestingFrom);
  }
 catch (  MalformedURLException e) {
    Logger.log(AndroidLogger.TYPE_ERROR_WORKFLOW,"String_Node_Str" + "String_Node_Str");
    return null;
  }
}

Fixed version (ground truth):
private String getURLToTry(){
  if (!requestedFromProd) {
    urlCurrentlyRequestingFrom=PROD_URL;
  }
 else   if (!requestedFromIndia) {
    urlCurrentlyRequestingFrom=INDIA_URL;
  }
 else {
    return null;
  }
  return urlCurrentlyRequestingFrom;
}
Program: 142002
Project: 142002
Buggy source:
/** 
 * @return whether a request was initiated
 */
private boolean requestAppList(){
  URL urlToTry=getURLToTry();
  if (urlToTry != null) {
    final View processingRequestView=findViewById(R.id.processing_request_view);
    SimpleHttpTask task=new SimpleHttpTask(this,urlToTry,new HashMap<String,String>(),false,new Pair<>(getUsernameForAuth(),((EditText)findViewById(R.id.edit_password)).getText().toString())){
      @Override protected void onPreExecute(){
        super.onPreExecute();
        processingRequestView.setVisibility(View.VISIBLE);
      }
      @Override protected void onPostExecute(      Void result){
        super.onPostExecute(result);
        processingRequestView.setVisibility(View.GONE);
      }
    }
;
    task.connect((CommCareTaskConnector)this);
    task.setResponseProcessor(this);
    setAttemptedRequestFlag();
    task.executeParallel();
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @return whether a request was initiated
 */
private boolean requestAppList(){
  String urlToTry=getURLToTry();
  if (urlToTry != null) {
    final View processingRequestView=findViewById(R.id.processing_request_view);
    String username=getUsernameForAuth();
    String password=((EditText)findViewById(R.id.edit_password)).getText().toString();
    SimpleGetTask task=new SimpleGetTask(username,password,this){
      @Override protected void onPreExecute(){
        super.onPreExecute();
        processingRequestView.setVisibility(View.VISIBLE);
      }
      @Override protected void onPostExecute(      Void result){
        super.onPostExecute(result);
        processingRequestView.setVisibility(View.GONE);
      }
    }
;
    task.connect((CommCareTaskConnector)this);
    setAttemptedRequestFlag();
    task.executeParallel(urlToTry);
    return true;
  }
  return false;
}
Program: 142003
Project: 142003
Buggy source:
@Override public boolean onPrepareOptionsMenu(Menu menu){
  super.onPrepareOptionsMenu(menu);
  menu.findItem(RETRIEVE_APPS_FOR_DIFF_USER).setVisible(appsListContainer.getVisibility() == View.VISIBLE);
  return true;
}

Fixed version (ground truth):
@Override public boolean onPrepareOptionsMenu(Menu menu){
  super.onPrepareOptionsMenu(menu);
  menu.findItem(RETRIEVE_APPS_FOR_DIFF_USER).setVisible(appsListContainer.getVisibility() != View.GONE);
  return true;
}
Program: 142004
Project: 142004
Buggy source:
@Override public CustomProgressDialog generateProgressDialog(int taskId){
  String title, message;
switch (taskId) {
case DataPullTask.DATA_PULL_TASK_ID:
    title=Localization.get("String_Node_Str");
  message=Localization.get("String_Node_Str");
break;
case SimpleHttpTask.SIMPLE_HTTP_TASK_ID:
title=Localization.get("String_Node_Str");
message=Localization.get("String_Node_Str");
break;
default :
Log.w(TAG,"String_Node_Str" + "String_Node_Str");
return null;
}
return CustomProgressDialog.newInstance(title,message,taskId);
}

Fixed version (ground truth):
@Override public CustomProgressDialog generateProgressDialog(int taskId){
  String title, message;
switch (taskId) {
case DataPullTask.DATA_PULL_TASK_ID:
    title=Localization.get("String_Node_Str");
  message=Localization.get("String_Node_Str");
break;
case ModernHttpTask.SIMPLE_HTTP_TASK_ID:
title=Localization.get("String_Node_Str");
message=Localization.get("String_Node_Str");
break;
default :
Log.w(TAG,"String_Node_Str" + "String_Node_Str");
return null;
}
return CustomProgressDialog.newInstance(title,message,taskId);
}
Program: 142005
Project: 142005
Buggy source:
private void makePostRequest(){
  if (!hasTaskLaunched && !inErrorState) {
    SimpleHttpTask postTask;
    try {
      postTask=new SimpleHttpTask(this,url,params,true,null);
    }
 catch (    ModernHttpRequester.PlainTextPasswordException e) {
      enterErrorState(Localization.get("String_Node_Str",url.toString()));
      return;
    }
    postTask.connect((CommCareTaskConnector)this);
    postTask.executeParallel();
    hasTaskLaunched=true;
  }
}

Fixed version (ground truth):
private void makePostRequest(){
  if (!hasTaskLaunched && !inErrorState) {
    ModernHttpTask postTask;
    try {
      postTask=new ModernHttpTask(this,url,params,true,null);
    }
 catch (    ModernHttpRequester.PlainTextPasswordException e) {
      enterErrorState(Localization.get("String_Node_Str",url.toString()));
      return;
    }
    postTask.connect((CommCareTaskConnector)this);
    postTask.executeParallel();
    hasTaskLaunched=true;
  }
}
Program: 142006
Project: 142006
Buggy source:
@Override public CustomProgressDialog generateProgressDialog(int taskId){
  String title, message;
switch (taskId) {
case SimpleHttpTask.SIMPLE_HTTP_TASK_ID:
    title=Localization.get("String_Node_Str");
  message=Localization.get("String_Node_Str");
break;
default :
Log.w(TAG,"String_Node_Str" + "String_Node_Str");
return null;
}
return CustomProgressDialog.newInstance(title,message,taskId);
}

Fixed version (ground truth):
@Override public CustomProgressDialog generateProgressDialog(int taskId){
  String title, message;
switch (taskId) {
case ModernHttpTask.SIMPLE_HTTP_TASK_ID:
    title=Localization.get("String_Node_Str");
  message=Localization.get("String_Node_Str");
break;
default :
Log.w(TAG,"String_Node_Str" + "String_Node_Str");
return null;
}
return CustomProgressDialog.newInstance(title,message,taskId);
}
Program: 142007
Project: 142007
Buggy source:
private void makeQueryRequest(){
  clearErrorState();
  URL url=remoteQuerySessionManager.getBaseUrl();
  SimpleHttpTask httpTask;
  try {
    httpTask=new SimpleHttpTask(this,url,new HashMap<>(remoteQuerySessionManager.getRawQueryParams()),false,null);
  }
 catch (  ModernHttpRequester.PlainTextPasswordException e) {
    enterErrorState(Localization.get("String_Node_Str",url.toString()));
    return;
  }
  httpTask.connect((CommCareTaskConnector)this);
  httpTask.executeParallel();
}

Fixed version (ground truth):
private void makeQueryRequest(){
  clearErrorState();
  URL url=remoteQuerySessionManager.getBaseUrl();
  ModernHttpTask httpTask;
  try {
    httpTask=new ModernHttpTask(this,url,new HashMap<>(remoteQuerySessionManager.getRawQueryParams()),false,null);
  }
 catch (  ModernHttpRequester.PlainTextPasswordException e) {
    enterErrorState(Localization.get("String_Node_Str",url.toString()));
    return;
  }
  httpTask.connect((CommCareTaskConnector)this);
  httpTask.executeParallel();
}
Program: 142008
Project: 142008
Buggy source:
protected static String buildDomainUser(String username){
  if (username != null) {
    SharedPreferences prefs=CommCareApplication.instance().getCurrentApp().getAppPreferences();
    if (prefs.contains(USER_DOMAIN_SUFFIX)) {
      username+="String_Node_Str" + prefs.getString(USER_DOMAIN_SUFFIX,null);
    }
  }
  return username;
}

Fixed version (ground truth):
protected static String buildDomainUser(String username){
  if (username != null && CommCareApplication.instance().getCurrentApp() != null) {
    SharedPreferences prefs=CommCareApplication.instance().getCurrentApp().getAppPreferences();
    if (prefs.contains(USER_DOMAIN_SUFFIX)) {
      username+="String_Node_Str" + prefs.getString(USER_DOMAIN_SUFFIX,null);
    }
  }
  return username;
}
Program: 142009
Project: 142009
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
  inflateView(inflater,container);
  if (savedInstanceState != null && savedInstanceState.containsKey(TIME)) {
    calendar=Calendar.getInstance();
    calendar.setTimeInMillis(savedInstanceState.getLong(TIME));
  }
  disableScreenRotation();
  initDisplay();
  initWeekDays();
  initOnClick();
  refresh();
  setWindowSize();
  return layout;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
  inflateView(inflater,container);
  disableScreenRotation();
  initDisplay();
  initWeekDays();
  initOnClick();
  refresh();
  setWindowSize();
  return layout;
}
Program: 142010
Project: 142010
Buggy source:
private void openCalendar(){
  setFocus(getContext());
  timeBeforeCalendarOpened=calendar.getTimeInMillis();
  myCalendarFragment.show(fm,"String_Node_Str");
}

Fixed version (ground truth):
private void openCalendar(){
  setFocus(getContext());
  timeBeforeCalendarOpened=getCurrentMillis();
  calendar.setTimeInMillis(timeBeforeCalendarOpened);
  myCalendarFragment.updateUnderlyingCalendar(calendar);
  myCalendarFragment.show(fm,"String_Node_Str");
}
Program: 142011
Project: 142011
Buggy source:
public GregorianDateWidget(Context context,FormEntryPrompt prompt,boolean closeButton){
  super(context,prompt);
  maxYear=calendar.get(Calendar.YEAR) + YEARSINFUTURE;
  todaysDateInMillis=calendar.getTimeInMillis();
  ImageButton clearAll=(ImageButton)findViewById(R.id.clear_all);
  if (closeButton) {
    clearAll.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View v){
        clearAll();
      }
    }
);
  }
 else {
    clearAll.setVisibility(View.GONE);
  }
  fm=((FragmentActivity)getContext()).getSupportFragmentManager();
  myCalendarFragment=new CalendarFragment();
  setupCalendarFragment();
  openCalButton=(ImageButton)findViewById(R.id.open_calendar_bottom);
  openCalButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      openCalendar();
    }
  }
);
  setAnswer();
}

Fixed version (ground truth):
public GregorianDateWidget(Context context,FormEntryPrompt prompt,boolean closeButton){
  super(context,prompt);
  maxYear=calendar.get(Calendar.YEAR) + YEARSINFUTURE;
  todaysDateInMillis=calendar.getTimeInMillis();
  ImageButton clearAll=(ImageButton)findViewById(R.id.clear_all);
  if (closeButton) {
    clearAll.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View v){
        clearAll();
      }
    }
);
  }
 else {
    clearAll.setVisibility(View.GONE);
  }
  fm=((FragmentActivity)getContext()).getSupportFragmentManager();
  myCalendarFragment=new CalendarFragment();
  myCalendarFragment.setListener(this);
  myCalendarFragment.setCancelable(false);
  myCalendarFragment.setToday(todaysDateInMillis);
  openCalButton=(ImageButton)findViewById(R.id.open_calendar_bottom);
  openCalButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      openCalendar();
    }
  }
);
  setAnswer();
}
Program: 142012
Project: 142012
Buggy source:
@Override protected void updateDateDisplay(long millisFromJavaEpoch){
  UniversalDate dateUniv=fromMillis(millisFromJavaEpoch);
  monthArrayPointer=dateUniv.month - 1;
  dayText.setText(String.format(DAYFORMAT,dateUniv.day));
  monthSpinner.setSelection(monthArrayPointer);
  yearText.setText(String.format(YEARFORMAT,dateUniv.year));
  calendar.setTimeInMillis(millisFromJavaEpoch);
  dayOfWeek.setText(calendar.getDisplayName(Calendar.DAY_OF_WEEK,Calendar.LONG,Locale.getDefault()));
  widgetEntryChanged();
}

Fixed version (ground truth):
@Override protected void updateDateDisplay(long millisFromJavaEpoch){
  UniversalDate dateUniv=fromMillis(millisFromJavaEpoch);
  monthArrayPointer=dateUniv.month - 1;
  dayText.setText(String.format(DAYFORMAT,dateUniv.day));
  monthSpinner.setSelection(monthArrayPointer);
  yearText.setText(String.format(YEARFORMAT,dateUniv.year));
  calendar.setTimeInMillis(millisFromJavaEpoch);
  dayOfWeek.setText(calendar.getDisplayName(Calendar.DAY_OF_WEEK,Calendar.LONG,Locale.getDefault()));
  if (dateOfLastWidgetUpdateNotice != millisFromJavaEpoch) {
    dateOfLastWidgetUpdateNotice=millisFromJavaEpoch;
    widgetEntryChanged();
  }
}
Program: 142013
Project: 142013
Buggy source:
@Override public void onClick(View v){
  errorMessageBox.setVisibility(View.INVISIBLE);
  if (inputIsValid()) {
    authenticateView.setVisibility(View.GONE);
    requestedFromIndia=false;
    requestedFromProd=false;
    failedDueToAuth=false;
    requestAppList();
  }
}

Fixed version (ground truth):
@Override public void onClick(View v){
  errorMessageBox.setVisibility(View.INVISIBLE);
  if (inputIsValid()) {
    authenticateView.setVisibility(View.GONE);
    requestedFromIndia=false;
    requestedFromProd=false;
    requestAppList();
  }
}
Program: 142014
Project: 142014
Buggy source:
private void repeatRequestOrShowResults(){
  if (!requestAppList()) {
    GlobalPrivilegesManager.storeRetrievedAvailableApps(availableApps);
    this.runOnUiThread(new Runnable(){
      @Override public void run(){
        if (availableApps.size() == 0) {
          if (failedDueToAuth) {
            enterErrorState("String_Node_Str");
          }
 else {
            enterErrorState("String_Node_Str");
          }
        }
 else {
          showResults();
        }
      }
    }
);
  }
}

Fixed version (ground truth):
private void repeatRequestOrShowResults(final boolean responseWasError){
  if (!requestAppList()) {
    GlobalPrivilegesManager.storeRetrievedAvailableApps(availableApps);
    this.runOnUiThread(new Runnable(){
      @Override public void run(){
        if (availableApps.size() == 0) {
          if (responseWasError) {
            enterErrorState("String_Node_Str" + "String_Node_Str");
          }
 else {
            enterErrorState("String_Node_Str");
          }
        }
 else {
          showResults();
        }
      }
    }
);
  }
}
Program: 142015
Project: 142015
Buggy source:
@Override public void run(){
  if (availableApps.size() == 0) {
    if (failedDueToAuth) {
      enterErrorState("String_Node_Str");
    }
 else {
      enterErrorState("String_Node_Str");
    }
  }
 else {
    showResults();
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (availableApps.size() == 0) {
    if (responseWasError) {
      enterErrorState("String_Node_Str" + "String_Node_Str");
    }
 else {
      enterErrorState("String_Node_Str");
    }
  }
 else {
    showResults();
  }
}
Program: 142016
Project: 142016
Buggy source:
@Override public void handleIOException(IOException exception){
  repeatRequestOrShowResults();
}

Fixed version (ground truth):
@Override public void handleIOException(IOException exception){
  repeatRequestOrShowResults(true);
}
Program: 142017
Project: 142017
Buggy source:
private void handleRequestError(int responseCode){
  System.out.println(responseCode);
  repeatRequestOrShowResults();
}

Fixed version (ground truth):
private void handleRequestError(int responseCode){
  System.out.println(responseCode);
  repeatRequestOrShowResults(true);
}
Program: 142018
Project: 142018
Buggy source:
@Override public void processClientError(int responseCode){
  if (responseCode == 401 || responseCode == 403) {
    failedDueToAuth=true;
  }
  handleRequestError(responseCode);
}

Fixed version (ground truth):
@Override public void processClientError(int responseCode){
  handleRequestError(responseCode);
}
Program: 142019
Project: 142019
Buggy source:
@Override public void processSuccess(int responseCode,InputStream responseData){
  System.out.println("String_Node_Str");
  processResponseIntoAppsList(responseData);
  repeatRequestOrShowResults();
}

Fixed version (ground truth):
@Override public void processSuccess(int responseCode,InputStream responseData){
  System.out.println("String_Node_Str");
  processResponseIntoAppsList(responseData);
  repeatRequestOrShowResults(false);
}
Program: 142020
Project: 142020
Buggy source:
private void setUpGetAppsButton(){
  Button getAppsButton=(Button)findViewById(R.id.get_apps_button);
  getAppsButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      errorMessageBox.setVisibility(View.INVISIBLE);
      if (inputIsValid()) {
        authenticateView.setVisibility(View.GONE);
        requestedFromIndia=false;
        requestedFromProd=false;
        failedDueToAuth=false;
        requestAppList();
      }
    }
  }
);
}

Fixed version (ground truth):
private void setUpGetAppsButton(){
  Button getAppsButton=(Button)findViewById(R.id.get_apps_button);
  getAppsButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      errorMessageBox.setVisibility(View.INVISIBLE);
      if (inputIsValid()) {
        authenticateView.setVisibility(View.GONE);
        requestedFromIndia=false;
        requestedFromProd=false;
        requestAppList();
      }
    }
  }
);
}
Program: 142021
Project: 142021
Buggy source:
@Override public void processSessionResponse(int statusCode){
  AndroidSessionWrapper asw=CommCareApplication.instance().getCurrentSessionWrapper();
switch (statusCode) {
case SessionNavigator.ASSERTION_FAILURE:
    handleAssertionFailureFromSessionNav(asw);
  break;
case SessionNavigator.NO_CURRENT_FORM:
handleNoFormFromSessionNav(asw);
break;
case SessionNavigator.START_FORM_ENTRY:
startFormEntry(asw);
break;
case SessionNavigator.GET_COMMAND:
handleGetCommand(asw);
break;
case SessionNavigator.START_ENTITY_SELECTION:
launchEntitySelect(asw.getSession());
break;
case SessionNavigator.LAUNCH_CONFIRM_DETAIL:
launchConfirmDetail(asw);
break;
case SessionNavigator.PROCESS_QUERY_REQUEST:
launchQueryMaker();
break;
case SessionNavigator.START_SYNC_REQUEST:
launchRemoteSync(asw);
break;
case SessionNavigator.XPATH_EXCEPTION_THROWN:
UserfacingErrorHandling.logErrorAndShowDialog(this,sessionNavigator.getCurrentException(),false);
break;
case SessionNavigator.REPORT_CASE_AUTOSELECT:
GoogleAnalyticsUtils.reportFeatureUsage(GoogleAnalyticsFields.ACTION_CASE_AUTOSELECT_USED);
break;
}
}

Fixed version (ground truth):
@Override public void processSessionResponse(int statusCode){
  AndroidSessionWrapper asw=CommCareApplication.instance().getCurrentSessionWrapper();
switch (statusCode) {
case SessionNavigator.ASSERTION_FAILURE:
    handleAssertionFailureFromSessionNav(asw);
  break;
case SessionNavigator.NO_CURRENT_FORM:
handleNoFormFromSessionNav(asw);
break;
case SessionNavigator.START_FORM_ENTRY:
startFormEntry(asw);
break;
case SessionNavigator.GET_COMMAND:
handleGetCommand(asw);
break;
case SessionNavigator.START_ENTITY_SELECTION:
launchEntitySelect(asw.getSession());
break;
case SessionNavigator.LAUNCH_CONFIRM_DETAIL:
launchConfirmDetail(asw);
break;
case SessionNavigator.PROCESS_QUERY_REQUEST:
launchQueryMaker();
break;
case SessionNavigator.START_SYNC_REQUEST:
launchRemoteSync(asw);
break;
case SessionNavigator.XPATH_EXCEPTION_THROWN:
UserfacingErrorHandling.logErrorAndShowDialog(this,sessionNavigator.getCurrentException(),false);
asw.reset();
break;
case SessionNavigator.REPORT_CASE_AUTOSELECT:
GoogleAnalyticsUtils.reportFeatureUsage(GoogleAnalyticsFields.ACTION_CASE_AUTOSELECT_USED);
break;
}
}
Program: 142022
Project: 142022
Buggy source:
@Override public IAnswerData getAnswer(){
  comboBox.dismissDropDown();
  String enteredText=comboBox.getText().toString();
  if (choiceTexts.contains(enteredText)) {
    int i=choiceTexts.indexOf(enteredText);
    return new SelectOneData(new Selection(choices.elementAt(i)));
  }
 else   if ("String_Node_Str".equals(enteredText)) {
    return null;
  }
 else {
    return new InvalidData("String_Node_Str",new SelectOneData(new Selection(0)));
  }
}

Fixed version (ground truth):
@Override public IAnswerData getAnswer(){
  comboBox.dismissDropDown();
  String enteredText=comboBox.getText().toString();
  if (choiceTexts.contains(enteredText)) {
    int i=choiceTexts.indexOf(enteredText);
    return new SelectOneData(new Selection(choices.elementAt(i)));
  }
 else   if ("String_Node_Str".equals(enteredText)) {
    return null;
  }
 else {
    return new InvalidData("String_Node_Str",new SelectOneData(new Selection(enteredText)));
  }
}
Program: 142023
Project: 142023
Buggy source:
private static boolean isTimeForAutoUpdateCheck(long lastUpdateCheck,String autoUpdateFreq){
  int checkEveryNDays;
  if (CommCarePreferences.FREQUENCY_DAILY.equals(autoUpdateFreq)) {
    checkEveryNDays=1;
  }
 else {
    checkEveryNDays=7;
  }
  long duration=DateUtils.DAY_IN_MILLIS * checkEveryNDays;
  return isPending(lastUpdateCheck,duration);
}

Fixed version (ground truth):
public static boolean isTimeForAutoUpdateCheck(long lastUpdateCheck,String autoUpdateFreq){
  int checkEveryNDays;
  if (CommCarePreferences.FREQUENCY_DAILY.equals(autoUpdateFreq)) {
    checkEveryNDays=1;
  }
 else {
    checkEveryNDays=7;
  }
  long duration=DateUtils.DAY_IN_MILLIS * checkEveryNDays;
  return isPending(lastUpdateCheck,duration);
}
Program: 142024
Project: 142024
Buggy source:
/** 
 * Test that trying to install an app with an invalid suite file results in the appropriate error message and a pinned notification with more details
 */
@Test public void invalidAppInstall(){
  String invalidUpdateReference="String_Node_Str";
  Intent setupIntent=new Intent(RuntimeEnvironment.application,CommCareSetupActivity.class);
  CommCareSetupActivity setupActivity=Robolectric.buildActivity(CommCareSetupActivity.class).withIntent(setupIntent).setup().get();
  ShadowActivity shadowActivity=Shadows.shadowOf(setupActivity);
  shadowActivity.clickMenuItem(CommCareSetupActivity.MODE_ARCHIVE);
  NotificationManager notificationManager=(NotificationManager)RuntimeEnvironment.application.getSystemService(Context.NOTIFICATION_SERVICE);
  Notification notification=Shadows.shadowOf(notificationManager).getNotification(CommCareApplication.MESSAGE_NOTIFICATION);
  assertNull(notification);
  Intent referenceIntent=new Intent();
  referenceIntent.putExtra(InstallArchiveActivity.ARCHIVE_JR_REFERENCE,invalidUpdateReference);
  shadowActivity.receiveResult(shadowActivity.getNextStartedActivity(),Activity.RESULT_OK,referenceIntent);
  Robolectric.flushBackgroundThreadScheduler();
  Robolectric.flushForegroundThreadScheduler();
  assertTrue(setupActivity.getErrorMessageToDisplay().contains(Localization.get("String_Node_Str")));
  notification=Shadows.shadowOf(notificationManager).getNotification(CommCareApplication.MESSAGE_NOTIFICATION);
  assertNotNull(notification);
}

Fixed version (ground truth):
/** 
 * Test that trying to install an app with an invalid suite file results in the appropriate error message and a pinned notification with more details
 */
@Test public void invalidAppInstall(){
  String invalidUpdateReference="String_Node_Str";
  Intent setupIntent=new Intent(RuntimeEnvironment.application,CommCareSetupActivity.class);
  CommCareSetupActivity setupActivity=Robolectric.buildActivity(CommCareSetupActivity.class).withIntent(setupIntent).setup().get();
  ShadowActivity shadowActivity=Shadows.shadowOf(setupActivity);
  shadowActivity.clickMenuItem(CommCareSetupActivity.MODE_ARCHIVE);
  NotificationManager notificationManager=(NotificationManager)RuntimeEnvironment.application.getSystemService(Context.NOTIFICATION_SERVICE);
  Notification notification=Shadows.shadowOf(notificationManager).getNotification(CommCareNoficationManager.MESSAGE_NOTIFICATION);
  assertNull(notification);
  Intent referenceIntent=new Intent();
  referenceIntent.putExtra(InstallArchiveActivity.ARCHIVE_JR_REFERENCE,invalidUpdateReference);
  shadowActivity.receiveResult(shadowActivity.getNextStartedActivity(),Activity.RESULT_OK,referenceIntent);
  Robolectric.flushBackgroundThreadScheduler();
  Robolectric.flushForegroundThreadScheduler();
  assertTrue(setupActivity.getErrorMessageToDisplay().contains(Localization.get("String_Node_Str")));
  notification=Shadows.shadowOf(notificationManager).getNotification(CommCareNoficationManager.MESSAGE_NOTIFICATION);
  assertNotNull(notification);
}
Program: 142026
Project: 142026
Buggy source:
@Test public void testAppInit(){
  Assert.assertFalse(CommCareApplication.instance().isUpdatePending());
  Profile p=CommCareApplication.instance().getCommCarePlatform().getCurrentProfile();
  Assert.assertTrue(p.getVersion() == 8);
}

Fixed version (ground truth):
@Test public void testAppInit(){
  Assert.assertFalse(PendingCalcs.isUpdatePending(CommCareApplication.instance().getCurrentApp().getAppPreferences()));
  Profile p=CommCareApplication.instance().getCommCarePlatform().getCurrentProfile();
  Assert.assertTrue(p.getVersion() == 8);
}
Program: 142028
Project: 142028
Buggy source:
@Override public void handleTaskCompletion(ResultAndError<AppInstallStatus> result){
  if (CommCareApplication._().isConsumerApp()) {
    dismissProgressDialog();
  }
  if (result.data == AppInstallStatus.UpdateStaged) {
    uiController.unappliedUpdateAvailableUiState();
    if (proceedAutomatically) {
      launchUpdateInstallTask();
    }
  }
 else   if (result.data == AppInstallStatus.UpToDate) {
    uiController.upToDateUiState();
    if (proceedAutomatically) {
      finishWithResult(RefreshToLatestBuildActivity.ALREADY_UP_TO_DATE);
    }
  }
 else {
    if (!"String_Node_Str".equals(result.errorMessage)) {
      String[] resouceAndMessage=result.errorMessage.split("String_Node_Str",2);
      CommCareApplication._().reportNotificationMessage(NotificationMessageFactory.message(AppInstallStatus.InvalidResource,new String[]{null,resouceAndMessage[0],resouceAndMessage[1]}),true);
    }
    uiController.checkFailedUiState();
    if (proceedAutomatically) {
      finishWithResult(RefreshToLatestBuildActivity.UPDATE_ERROR);
    }
  }
  unregisterTask();
  uiController.refreshView();
}

Fixed version (ground truth):
@Override public void handleTaskCompletion(ResultAndError<AppInstallStatus> result){
  if (CommCareApplication._().isConsumerApp()) {
    dismissProgressDialog();
  }
  if (result.data == AppInstallStatus.UpdateStaged) {
    uiController.unappliedUpdateAvailableUiState();
    if (proceedAutomatically) {
      launchUpdateInstallTask();
    }
  }
 else   if (result.data == AppInstallStatus.UpToDate) {
    uiController.upToDateUiState();
    if (proceedAutomatically) {
      finishWithResult(RefreshToLatestBuildActivity.ALREADY_UP_TO_DATE);
    }
  }
 else {
    if (UpdateTask.isCombinedErrorMessage(result.errorMessage)) {
      Pair<String,String> resouceAndMessage=UpdateTask.splitCombinedErrorMessage(result.errorMessage);
      CommCareApplication._().reportNotificationMessage(NotificationMessageFactory.message(AppInstallStatus.InvalidResource,new String[]{null,resouceAndMessage.first,resouceAndMessage.second}),true);
    }
    uiController.checkFailedUiState();
    if (proceedAutomatically) {
      finishWithResult(RefreshToLatestBuildActivity.UPDATE_ERROR);
    }
  }
  unregisterTask();
  uiController.refreshView();
}
Program: 142029
Project: 142029
Buggy source:
@Override protected final ResultAndError<AppInstallStatus> doInBackground(String... params){
  profileRef=params[0];
  setupUpdate();
  try {
    return new ResultAndError<>(stageUpdate());
  }
 catch (  InvalidResourceException e) {
    ResourceInstallUtils.logInstallError(e,"String_Node_Str");
    String combinedMessage=e.resourceName + "String_Node_Str" + e.getMessage();
    return new ResultAndError<>(AppInstallStatus.UnknownFailure,combinedMessage);
  }
catch (  Exception e) {
    ResourceInstallUtils.logInstallError(e,"String_Node_Str");
    return new ResultAndError<>(AppInstallStatus.UnknownFailure,e.getMessage());
  }
}

Fixed version (ground truth):
@Override protected final ResultAndError<AppInstallStatus> doInBackground(String... params){
  profileRef=params[0];
  setupUpdate();
  try {
    return new ResultAndError<>(stageUpdate());
  }
 catch (  InvalidResourceException e) {
    ResourceInstallUtils.logInstallError(e,"String_Node_Str");
    return new ResultAndError<>(AppInstallStatus.UnknownFailure,buildCombinedErrorMessage(e.resourceName,e.getMessage()));
  }
catch (  Exception e) {
    ResourceInstallUtils.logInstallError(e,"String_Node_Str");
    return new ResultAndError<>(AppInstallStatus.UnknownFailure,e.getMessage());
  }
}
Program: 142031
Project: 142031
Buggy source:
public static EntitySelectActivity launchEntitySelectActivity(String command){
  ShadowActivity shadowHomeActivity=ActivityLaunchUtils.buildHomeActivityForFormEntryLaunch(command);
  Intent entitySelectIntent=shadowHomeActivity.getNextStartedActivity();
  String intentActivityName=entitySelectIntent.getComponent().getClassName();
  Assert.assertEquals(EntitySelectActivity.class.getName(),intentActivityName);
  return Robolectric.buildActivity(EntitySelectActivity.class).withIntent(entitySelectIntent).create().start().resume().get();
}

Fixed version (ground truth):
public static EntitySelectActivity launchEntitySelectActivity(String command){
  ShadowActivity shadowHomeActivity=ActivityLaunchUtils.buildHomeActivityForFormEntryLaunch(command);
  Intent entitySelectIntent=shadowHomeActivity.getNextStartedActivity();
  String intentActivityName=entitySelectIntent.getComponent().getClassName();
  Assert.assertEquals(EntitySelectActivity.class.getName(),intentActivityName);
  return Robolectric.buildActivity(EntitySelectActivity.class).withIntent(entitySelectIntent).setup().get();
}
Program: 142032
Project: 142032
Buggy source:
private void initUIComponents(){
  searchBanner=findViewById(R.id.search_result_banner);
  searchResultStatus=(TextView)findViewById(R.id.search_results_status);
  header=(LinearLayout)findViewById(R.id.entity_select_header);
  clearSearchButton=(ImageButton)findViewById(R.id.clear_search_button);
  clearSearchButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      adapter.clearCalloutResponseData();
      refreshView();
    }
  }
);
  clearSearchButton.setVisibility(View.GONE);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void initUIComponents(){
  searchBanner=findViewById(R.id.search_result_banner);
  searchResultStatus=(TextView)findViewById(R.id.search_results_status);
  header=(LinearLayout)findViewById(R.id.entity_select_header);
  clearSearchButton=(ImageButton)findViewById(R.id.clear_search_button);
  clearSearchButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      adapter.clearCalloutResponseData();
      searchBanner.setVisibility(View.GONE);
      if (isUsingActionBar()) {
        searchView.setQuery("String_Node_Str",false);
      }
 else {
        preHoneycombSearchBox.setText("String_Node_Str");
      }
      ViewUtil.hideVirtualKeyboard(EntitySelectActivity.this);
      refreshView();
    }
  }
);
  clearSearchButton.setVisibility(View.GONE);
}
Program: 142033
Project: 142033
Buggy source:
@Override public void afterTextChanged(Editable incomingEditable){
  final String incomingString=incomingEditable.toString();
  final String currentSearchText=getSearchText().toString();
  if (!"String_Node_Str".equals(currentSearchText) && incomingString.equals(currentSearchText)) {
    filterString=currentSearchText;
    if (adapter != null) {
      adapter.filterByString(filterString);
    }
  }
  if (!isUsingActionBar()) {
    lastQueryString=filterString;
  }
}

Fixed version (ground truth):
@Override public void afterTextChanged(Editable incomingEditable){
  final String incomingString=incomingEditable.toString();
  final String currentSearchText=getSearchText().toString();
  if (incomingString.equals(currentSearchText)) {
    filterString=currentSearchText;
    if (adapter != null) {
      adapter.filterByString(filterString);
    }
  }
  if (!isUsingActionBar()) {
    lastQueryString=filterString;
  }
}
Program: 142034
Project: 142034
Buggy source:
private void setSearchBannerState(){
  if (!"String_Node_Str".equals(adapter.getSearchQuery())) {
    showSearchBanner();
  }
 else   if (adapter.isFilteringByCalloutResult()) {
    showSearchBanner();
    clearSearchButton.setVisibility(View.VISIBLE);
  }
 else {
    searchBanner.setVisibility(View.GONE);
    clearSearchButton.setVisibility(View.GONE);
  }
}

Fixed version (ground truth):
private void setSearchBannerState(){
  if (!"String_Node_Str".equals(adapter.getSearchQuery()) || adapter.isFilteringByCalloutResult()) {
    showSearchBanner();
    clearSearchButton.setVisibility(View.VISIBLE);
  }
 else {
    searchBanner.setVisibility(View.GONE);
    clearSearchButton.setVisibility(View.GONE);
  }
}
Program: 142035
Project: 142035
Buggy source:
public void setFocus(Context context,int indexOfLastChangedWidget){
  QuestionWidget widgetToFocus=null;
  if (indexOfLastChangedWidget != -1) {
    widgetToFocus=widgets.get(indexOfLastChangedWidget);
  }
 else   if (widgets.size() > 0) {
    widgetToFocus=widgets.get(0);
  }
  if (widgetToFocus != null) {
    scrollToWidget(widgetToFocus);
    widgetToFocus.setFocus(context);
  }
}

Fixed version (ground truth):
public void setFocus(Context context,int indexOfLastChangedWidget){
  QuestionWidget widgetToFocus=null;
  if (indexOfLastChangedWidget != -1 && indexOfLastChangedWidget < widgets.size()) {
    widgetToFocus=widgets.get(indexOfLastChangedWidget);
  }
 else   if (widgets.size() > 0) {
    widgetToFocus=widgets.get(0);
  }
  if (widgetToFocus != null) {
    scrollToWidget(widgetToFocus);
    widgetToFocus.setFocus(context);
  }
}
Program: 142036
Project: 142036
Buggy source:
protected void attachToForm(FormDef form){
  this.formDef=form;
}

Fixed version (ground truth):
public void attachToForm(FormDef form){
  this.formDef=form;
}
Program: 142037
Project: 142037
Buggy source:
@Override public void setupTextView(){
  if (isEditable) {
    mStringAnswer=new EditText(getContext());
    mStringAnswer.setTextSize(TypedValue.COMPLEX_UNIT_DIP,mAnswerFontsize);
    mStringAnswer.setGravity(Gravity.CENTER);
    String s=mPrompt.getAnswerText();
    if (s != null) {
      mStringAnswer.setText(s);
    }
    addView(mStringAnswer);
  }
 else {
    super.setupTextView();
  }
}

Fixed version (ground truth):
@Override public void setupTextView(){
  if (isEditable) {
    mStringAnswer=new EditText(getContext());
    mStringAnswer.addTextChangedListener(this);
    mStringAnswer.setTextSize(TypedValue.COMPLEX_UNIT_DIP,mAnswerFontsize);
    mStringAnswer.setGravity(Gravity.CENTER);
    String s=mPrompt.getAnswerText();
    if (s != null) {
      mStringAnswer.setText(s);
    }
    addView(mStringAnswer);
  }
 else {
    super.setupTextView();
  }
}
Program: 142038
Project: 142038
Buggy source:
@Override public IAnswerData getAnswer(){
  if (isEditable && hasTextChanged) {
    hasTextChanged=false;
    String s=mStringAnswer.getText().toString();
    if ("String_Node_Str".equals(s)) {
      return null;
    }
 else {
      return new StringData(s);
    }
  }
 else {
    return mPrompt.getAnswerValue();
  }
}

Fixed version (ground truth):
@Override public IAnswerData getAnswer(){
  if (isEditable && hasTextChanged) {
    storeTextAnswerToForm();
  }
  return mPrompt.getAnswerValue();
}
Program: 142039
Project: 142039
Buggy source:
public BarcodeWidget(Context context,FormEntryPrompt prompt,Intent i,IntentCallout ic,PendingCalloutInterface pendingCalloutInterface){
  super(context,prompt,i,ic,pendingCalloutInterface,"String_Node_Str","String_Node_Str","String_Node_Str");
  isEditable=ic.getAppearance().contains("String_Node_Str");
}

Fixed version (ground truth):
public BarcodeWidget(Context context,FormEntryPrompt prompt,Intent i,IntentCallout ic,PendingCalloutInterface pendingCalloutInterface){
  super(context,prompt,i,ic,pendingCalloutInterface,"String_Node_Str","String_Node_Str","String_Node_Str");
}
Program: 142040
Project: 142040
Buggy source:
protected IntentWidget(Context context,FormEntryPrompt prompt,Intent in,IntentCallout ic,PendingCalloutInterface pendingCalloutInterface,String getButtonLocalizationKey,String updateButtonLocalizationKey,String missingCalloutKey){
  super(context,prompt);
  this.missingCalloutKey=missingCalloutKey;
  this.intent=in;
  this.ic=ic;
  this.pendingCalloutInterface=pendingCalloutInterface;
  this.getButtonLocalizationKey=getButtonLocalizationKey;
  this.updateButtonLocalizationKey=updateButtonLocalizationKey;
  mStringAnswer=new TextView(getContext());
  launchIntentButton=new Button(getContext());
  setupTextView();
  setupButton();
}

Fixed version (ground truth):
protected IntentWidget(Context context,FormEntryPrompt prompt,Intent in,IntentCallout ic,PendingCalloutInterface pendingCalloutInterface,String getButtonLocalizationKey,String updateButtonLocalizationKey,String missingCalloutKey){
  super(context,prompt);
  this.missingCalloutKey=missingCalloutKey;
  this.intent=in;
  this.ic=ic;
  this.pendingCalloutInterface=pendingCalloutInterface;
  this.getButtonLocalizationKey=getButtonLocalizationKey;
  this.updateButtonLocalizationKey=updateButtonLocalizationKey;
  isEditable=ic.getAppearance().contains("String_Node_Str");
  mStringAnswer=new TextView(getContext());
  launchIntentButton=new Button(getContext());
  setupTextView();
  setupButton();
}
Program: 142041
Project: 142041
Buggy source:
@Override public void refreshView(){
  adapter.notifyDataSetChanged();
}

Fixed version (ground truth):
@Override public void refreshView(){
  if (adapter != null) {
    adapter.notifyDataSetChanged();
  }
}
Program: 142042
Project: 142042
Buggy source:
public SpinnerAdapter(final Context context,final int textViewResourceId,final String[] objects,int textUnit,float textSize){
  super(context,textViewResourceId,objects);
  this.context=context;
  this.textUnit=textUnit;
  this.textSize=textSize;
  items=new String[objects.length + 1];
  items[0]="String_Node_Str";
  System.arraycopy(objects,0,items,1,items.length - 1);
}

Fixed version (ground truth):
public SpinnerAdapter(final Context context,final int textViewResourceId,final String[] objects,int textUnit,float textSize){
  super(context,textViewResourceId,objects);
  this.items=objects;
  this.context=context;
  this.textUnit=textUnit;
  this.textSize=textSize;
}
Program: 142043
Project: 142043
Buggy source:
public SpinnerWidget(Context context,FormEntryPrompt prompt){
  super(context,prompt);
  mItems=prompt.getSelectChoices();
  spinner=new Spinner(context);
  choices=new String[mItems.size()];
  for (int i=0; i < mItems.size(); i++) {
    choices[i]=prompt.getSelectChoiceText(mItems.get(i));
  }
  SpinnerAdapter adapter=new SpinnerAdapter(getContext(),android.R.layout.simple_spinner_item,choices,TypedValue.COMPLEX_UNIT_DIP,mQuestionFontsize);
  spinner.setAdapter(adapter);
  spinner.setPrompt(prompt.getQuestionText());
  spinner.setEnabled(!prompt.isReadOnly());
  spinner.setFocusable(!prompt.isReadOnly());
  String s=null;
  if (prompt.getAnswerValue() != null) {
    s=((Selection)prompt.getAnswerValue().getValue()).getValue();
  }
  if (s != null) {
    for (int i=0; i < mItems.size(); ++i) {
      String sMatch=mItems.get(i).getValue();
      if (sMatch.equals(s)) {
        spinner.setSelection(i);
      }
    }
  }
  spinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parentView,    View selectedItemView,    int position,    long id){
      widgetEntryChanged();
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
  addView(spinner);
}

Fixed version (ground truth):
public SpinnerWidget(Context context,FormEntryPrompt prompt){
  super(context,prompt);
  mItems=prompt.getSelectChoices();
  spinner=new Spinner(context);
  choices=new String[mItems.size()];
  for (int i=0; i < mItems.size(); i++) {
    choices[i]=prompt.getSelectChoiceText(mItems.get(i));
  }
  SpinnerAdapter adapter=new SpinnerAdapter(getContext(),android.R.layout.simple_spinner_item,getChoicesWithEmptyFirstSlot(choices),TypedValue.COMPLEX_UNIT_DIP,mQuestionFontsize);
  spinner.setAdapter(adapter);
  spinner.setPrompt(prompt.getQuestionText());
  spinner.setEnabled(!prompt.isReadOnly());
  spinner.setFocusable(!prompt.isReadOnly());
  String s=null;
  if (prompt.getAnswerValue() != null) {
    s=((Selection)prompt.getAnswerValue().getValue()).getValue();
  }
  if (s != null) {
    for (int i=0; i < mItems.size(); ++i) {
      String sMatch=mItems.get(i).getValue();
      if (sMatch.equals(s)) {
        spinner.setSelection(i);
      }
    }
  }
  spinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parentView,    View selectedItemView,    int position,    long id){
      widgetEntryChanged();
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
  addView(spinner);
}
Program: 142044
Project: 142044
Buggy source:
@Override public void onDismiss(DialogInterface dialog){
  super.onDismiss(dialog);
  if (myListener != null) {
    myListener.onCalendarClose();
  }
}

Fixed version (ground truth):
@Override public void onDismiss(DialogInterface dialog){
  super.onDismiss(dialog);
  enableScreenRotation();
  if (myListener != null) {
    myListener.onCalendarClose();
  }
}
Program: 142045
Project: 142045
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
  myLayout=(LinearLayout)inflater.inflate(R.layout.calendar_widget,container);
  if (savedInstanceState != null && savedInstanceState.containsKey(TIME)) {
    calendar=Calendar.getInstance();
    calendar.setTimeInMillis(savedInstanceState.getLong(TIME));
  }
  initDisplay();
  initWeekDays();
  initOnClick();
  refresh();
  Rect displayRectangle=new Rect();
  Window window=getActivity().getWindow();
  window.getDecorView().getWindowVisibleDisplayFrame(displayRectangle);
  myLayout.setMinimumWidth((int)(displayRectangle.width() * 0.9f));
  return myLayout;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
  myLayout=(LinearLayout)inflater.inflate(R.layout.calendar_widget,container);
  if (savedInstanceState != null && savedInstanceState.containsKey(TIME)) {
    calendar=Calendar.getInstance();
    calendar.setTimeInMillis(savedInstanceState.getLong(TIME));
  }
  disableScreenRotation();
  initDisplay();
  initWeekDays();
  initOnClick();
  refresh();
  Rect displayRectangle=new Rect();
  Window window=getActivity().getWindow();
  window.getDecorView().getWindowVisibleDisplayFrame(displayRectangle);
  myLayout.setMinimumWidth((int)(displayRectangle.width() * 0.9f));
  return myLayout;
}
Program: 142046
Project: 142046
Buggy source:
@Override protected void onActivityResult(int requestCode,int resultCode,Intent intent){
switch (requestCode) {
case WIFI_DIRECT_ACTIVITY:
    if (resultCode == WipeTask.WIPE_TASK_ID || resultCode == SendTask.BULK_SEND_ID) {
      int dumpedCount=intent.getIntExtra(CommCareWiFiDirectActivity.KEY_NUMBER_DUMPED,-1);
      Intent returnIntent=new Intent();
      returnIntent.putExtra(FORM_PROCESS_COUNT_KEY,dumpedCount);
      returnIntent.putExtra(FORM_PROCESS_MESSAGE_KEY,"String_Node_Str");
      setResult(RESULT_FORMS_PROCESSED,returnIntent);
      finish();
    }
  break;
case DUMP_FORMS_ACTIVITY:
if (resultCode == DumpTask.BULK_DUMP_ID || resultCode == SendTask.BULK_SEND_ID) {
  int dumpedCount=intent.getIntExtra(CommCareFormDumpActivity.KEY_NUMBER_DUMPED,-1);
  Intent returnIntent=new Intent();
  returnIntent.putExtra(FORM_PROCESS_COUNT_KEY,dumpedCount);
  returnIntent.putExtra(FORM_PROCESS_MESSAGE_KEY,"String_Node_Str");
  setResult(RESULT_FORMS_PROCESSED,returnIntent);
  finish();
}
break;
default :
break;
}
}

Fixed version (ground truth):
@Override protected void onActivityResult(int requestCode,int resultCode,Intent intent){
  if (requestCode == WIFI_DIRECT_ACTIVITY || requestCode == DUMP_FORMS_ACTIVITY) {
    String messageKey=getBulkFormMessageKey(resultCode);
    if (messageKey == null) {
      return;
    }
    int dumpedCount=intent.getIntExtra(KEY_NUMBER_DUMPED,-1);
    Intent returnIntent=new Intent();
    returnIntent.putExtra(FORM_PROCESS_COUNT_KEY,dumpedCount);
    returnIntent.putExtra(FORM_PROCESS_MESSAGE_KEY,messageKey);
    setResult(RESULT_FORMS_PROCESSED,returnIntent);
    finish();
  }
}
Program: 142048
Project: 142048
Buggy source:
@Override protected void deliverResult(CommCareFormDumpActivity receiver,Boolean result){
  if (result == Boolean.TRUE) {
    Intent i=new Intent(getIntent());
    i.putExtra(KEY_NUMBER_DUMPED,formsOnPhone);
    receiver.setResult(BULK_DUMP_ID,i);
    Logger.log(AndroidLogger.TYPE_FORM_DUMP,"String_Node_Str" + formsOnPhone + "String_Node_Str");
    receiver.finish();
  }
 else {
    receiver.transplantStyle(txtInteractiveMessages,R.layout.template_text_notification_problem);
  }
}

Fixed version (ground truth):
@Override protected void deliverResult(CommCareFormDumpActivity receiver,Boolean result){
  if (result == Boolean.TRUE) {
    Intent i=new Intent(getIntent());
    i.putExtra(AdvancedActionsActivity.KEY_NUMBER_DUMPED,formsOnPhone);
    receiver.setResult(BULK_DUMP_ID,i);
    Logger.log(AndroidLogger.TYPE_FORM_DUMP,"String_Node_Str" + formsOnPhone + "String_Node_Str");
    receiver.finish();
  }
 else {
    receiver.transplantStyle(txtInteractiveMessages,R.layout.template_text_notification_problem);
  }
}
Program: 142049
Project: 142049
Buggy source:
private void startAdvancedActionsActivity(){
  startActivity(new Intent(this,AdvancedActionsActivity.class));
}

Fixed version (ground truth):
private void startAdvancedActionsActivity(){
  startActivityForResult(new Intent(this,AdvancedActionsActivity.class),ADVANCED_ACTIONS_ACTIVITY);
}
Program: 142051
Project: 142051
Buggy source:
public void startUserSession(byte[] symetricKey,UserKeyRecord record,boolean restoreSession){
synchronized (serviceLock) {
    if (this.mIsBound) {
      releaseUserResourcesAndServices();
    }
    bindUserSessionService(symetricKey,record,restoreSession);
  }
}

Fixed version (ground truth):
public void startUserSession(byte[] symmetricKey,UserKeyRecord record,boolean restoreSession){
synchronized (serviceLock) {
    SessionActivityRegistration.unregisterSessionExpiration();
    if (this.mIsBound) {
      releaseUserResourcesAndServices();
    }
    bindUserSessionService(symmetricKey,record,restoreSession);
  }
}
Program: 142052
Project: 142052
Buggy source:
public void setCurrentUser(User user,String password){
  this.user=user;
  this.user.setCachedPwd(password);
  this.key=user.getWrappedKey();
}

Fixed version (ground truth):
public void setCurrentUser(User user,String password){
  this.user=user;
  this.user.setCachedPwd(password);
}
Program: 142053
Project: 142053
Buggy source:
private byte[] getEncryptionKey(){
  byte[] key;
  if (loginNeeded) {
    initUKRForLogin();
    if (ukrForLogin == null) {
      return null;
    }
    key=ByteEncrypter.wrapByteArrayWithString(ukrForLogin.getEncryptedKey(),password);
  }
 else {
    key=CommCareApplication._().getSession().getLoggedInUser().getWrappedKey();
  }
  this.publishProgress(PROGRESS_CLEANED);
  return key;
}

Fixed version (ground truth):
private byte[] getEncryptionKey(){
  byte[] key;
  if (loginNeeded) {
    initUKRForLogin();
    if (ukrForLogin == null) {
      return null;
    }
    key=ukrForLogin.getEncryptedKey();
  }
 else {
    key=CommCareApplication._().getSession().getLoggedInUser().getWrappedKey();
  }
  this.publishProgress(PROGRESS_CLEANED);
  return key;
}