nus-yam/ex-repair huggingface dataset:
Program: 142209
Project: 142209
Buggy source:
public void done(boolean requireRefresh){
  if (Intent.ACTION_VIEW.equals(CommCareVerificationActivity.this.getIntent().getAction())) {
    Log.i("String_Node_Str","String_Node_Str");
    Intent i=new Intent(getApplicationContext(),CommCareHomeActivity.class);
    i.putExtra(KEY_REQUIRE_REFRESH,requireRefresh);
    startActivity(i);
    finish();
  }
 else {
    Log.i("String_Node_Str","String_Node_Str");
    Intent i=new Intent(getIntent());
    boolean fromManager=this.getIntent().getBooleanExtra(AppManagerActivity.KEY_LAUNCH_FROM_MANAGER,false);
    Log.i("String_Node_Str","String_Node_Str" + fromManager);
    i.putExtra(KEY_REQUIRE_REFRESH,requireRefresh);
    setResult(RESULT_OK,i);
    finish();
  }
}

Fixed version (ground truth):
public void done(boolean requireRefresh){
  if (Intent.ACTION_VIEW.equals(CommCareVerificationActivity.this.getIntent().getAction())) {
    Intent i=new Intent(getApplicationContext(),CommCareHomeActivity.class);
    i.putExtra(KEY_REQUIRE_REFRESH,requireRefresh);
    startActivity(i);
    finish();
    return;
  }
 else {
    Intent i=new Intent(getIntent());
    i.putExtra(KEY_REQUIRE_REFRESH,requireRefresh);
    setResult(RESULT_OK,i);
    finish();
    return;
  }
}
Program: 142210
Project: 142210
Buggy source:
@Override public void onResume(){
  super.onResume();
  boolean shouldBeHere=(CommCareApplication._().getVisibleAppRecords().size() == 1 && CommCareApplication._().getReadyAppRecords().size() == 0);
  if (!shouldBeHere) {
    Intent i=new Intent(this,CommCareHomeActivity.class);
    this.startActivity(i);
  }
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  boolean shouldBeHere=(CommCareApplication._().getVisibleAppRecords().size() == 1 && CommCareApplication._().getReadyAppRecords().size() == 0);
  if (!fromManager && !shouldBeHere) {
    Intent i=new Intent(this,CommCareHomeActivity.class);
    this.startActivity(i);
  }
}
Program: 142212
Project: 142212
Buggy source:
/** 
 * Http requests are not so simple as "opening a request". Occasionally we may have to deal with redirects. We don't want to just accept any redirect, though, since we may be directed away from a secure connection. For now we'll only accept redirects from HTTP -> * servers, or HTTPS -> HTTPS severs on the same domain
 * @param client
 * @param request
 * @return
 */
private HttpResponse execute(HttpClient client,HttpUriRequest request) throws IOException {
  HttpContext context=new BasicHttpContext();
  HttpResponse response=client.execute(request,context);
  HttpUriRequest currentReq=(HttpUriRequest)context.getAttribute(ExecutionContext.HTTP_REQUEST);
  HttpHost currentHost=(HttpHost)context.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
  String currentUrl=currentHost.toURI() + currentReq.getURI();
  URL originalRequest=request.getURI().toURL();
  URL finalRedirect=new URL(currentUrl);
  if (!isValidRedirect(originalRequest,finalRedirect)) {
    Logger.log(AndroidLogger.TYPE_WARNING_NETWORK,"String_Node_Str" + originalRequest.toString() + "String_Node_Str"+ finalRedirect.toString());
    throw new IOException("String_Node_Str");
  }
  return response;
}

Fixed version (ground truth):
/** 
 * Http requests are not so simple as "opening a request". Occasionally we may have to deal with redirects. We don't want to just accept any redirect, though, since we may be directed away from a secure connection. For now we'll only accept redirects from HTTP -> * servers, or HTTPS -> HTTPS severs on the same domain
 */
private HttpResponse execute(HttpClient client,HttpUriRequest request) throws IOException {
  HttpContext context=new BasicHttpContext();
  HttpResponse response=client.execute(request,context);
  HttpUriRequest currentReq=(HttpUriRequest)context.getAttribute(ExecutionContext.HTTP_REQUEST);
  HttpHost currentHost=(HttpHost)context.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
  String currentUrl=currentHost.toURI() + currentReq.getURI();
  URL originalRequest=request.getURI().toURL();
  URL finalRedirect=new URL(currentUrl);
  if (!isValidRedirect(originalRequest,finalRedirect)) {
    Logger.log(AndroidLogger.TYPE_WARNING_NETWORK,"String_Node_Str" + originalRequest.toString() + "String_Node_Str"+ finalRedirect.toString());
    throw new IOException("String_Node_Str");
  }
  return response;
}
Program: 142213
Project: 142213
Buggy source:
/** 
 * @param con
 * @throws IOException
 */
private void setup(HttpURLConnection con) throws IOException {
  con.setConnectTimeout(GlobalConstants.CONNECTION_TIMEOUT);
  con.setReadTimeout(GlobalConstants.CONNECTION_SO_TIMEOUT);
  con.setRequestMethod("String_Node_Str");
  con.setDoInput(true);
  con.setInstanceFollowRedirects(true);
}

Fixed version (ground truth):
private void setup(HttpURLConnection con) throws IOException {
  con.setConnectTimeout(GlobalConstants.CONNECTION_TIMEOUT);
  con.setReadTimeout(GlobalConstants.CONNECTION_SO_TIMEOUT);
  con.setRequestMethod("String_Node_Str");
  con.setDoInput(true);
  con.setInstanceFollowRedirects(true);
}
Program: 142217
Project: 142217
Buggy source:
public static String getStringRobust(Context c,int resId,String args){
  String resourceName=c.getResources().getResourceEntryName(resId);
  try {
    return Localization.get("String_Node_Str" + resourceName,new String[]{args});
  }
 catch (  NoLocalizedTextException e) {
    return c.getString(resId,args);
  }
}

Fixed version (ground truth):
public static String getStringRobust(Context c,int resId,String[] args){
  String resourceName=c.getResources().getResourceEntryName(resId);
  try {
    return Localization.get("String_Node_Str" + resourceName,args);
  }
 catch (  NoLocalizedTextException e) {
    return c.getString(resId,args);
  }
}
Program: 142218
Project: 142218
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setTitle(getString(R.string.app_name) + "String_Node_Str" + getString(R.string.get_location));
  mLocationManager=(LocationManager)getSystemService(Context.LOCATION_SERVICE);
  mProviders=GeoUtils.evaluateProviders(mLocationManager);
  setupLocationDialog();
  long mLong=-1;
  if (savedInstanceState != null) {
    mLong=savedInstanceState.getLong("String_Node_Str",-1);
  }
  if (mLong > 0) {
    mTimer=new ODKTimer(mLong,this);
  }
 else {
    mTimer=new ODKTimer(millisToWait,this);
  }
  mTimer.start();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setTitle(StringUtils.getStringRobust(this,R.string.app_name) + "String_Node_Str" + StringUtils.getStringRobust(this,R.string.get_location));
  mLocationManager=(LocationManager)getSystemService(Context.LOCATION_SERVICE);
  mProviders=GeoUtils.evaluateProviders(mLocationManager);
  setupLocationDialog();
  long mLong=-1;
  if (savedInstanceState != null) {
    mLong=savedInstanceState.getLong("String_Node_Str",-1);
  }
  if (mLong > 0) {
    mTimer=new ODKTimer(mLong,this);
  }
 else {
    mTimer=new ODKTimer(millisToWait,this);
  }
  mTimer.start();
}
Program: 142219
Project: 142219
Buggy source:
@Override public void onStatusChanged(String provider,int status,Bundle extras){
switch (status) {
case LocationProvider.AVAILABLE:
    if (mLocation != null) {
      mLocationDialog.setMessage(getString(R.string.location_accuracy,(int)mLocation.getAccuracy()));
    }
  break;
case LocationProvider.OUT_OF_SERVICE:
break;
case LocationProvider.TEMPORARILY_UNAVAILABLE:
break;
}
}

Fixed version (ground truth):
@Override public void onStatusChanged(String provider,int status,Bundle extras){
switch (status) {
case LocationProvider.AVAILABLE:
    if (mLocation != null) {
      mLocationDialog.setMessage(StringUtils.getStringRobust(this,R.string.location_accuracy,"String_Node_Str" + (int)mLocation.getAccuracy()));
    }
  break;
case LocationProvider.OUT_OF_SERVICE:
break;
case LocationProvider.TEMPORARILY_UNAVAILABLE:
break;
}
}
Program: 142220
Project: 142220
Buggy source:
@Override public void onLocationChanged(Location location){
  mLocation=location;
  if (mLocation != null) {
    mLocationDialog.setMessage(getString(R.string.location_provider_accuracy,mLocation.getProvider(),truncateDouble(mLocation.getAccuracy())));
    if (mLocation.getAccuracy() <= GeoUtils.GOOD_ACCURACY) {
      returnLocation();
    }
    mLocationDialog.setLocationFound(mLocation.getAccuracy() < GeoUtils.ACCEPTABLE_ACCURACY || mTimer.getMillisUntilFinished() == 0);
  }
}

Fixed version (ground truth):
@Override public void onLocationChanged(Location location){
  mLocation=location;
  if (mLocation != null) {
    String[] args={mLocation.getProvider(),truncateDouble(mLocation.getAccuracy())};
    mLocationDialog.setMessage(StringUtils.getStringRobust(this,R.string.location_provider_accuracy,args));
    if (mLocation.getAccuracy() <= GeoUtils.GOOD_ACCURACY) {
      returnLocation();
    }
    mLocationDialog.setLocationFound(mLocation.getAccuracy() < GeoUtils.ACCEPTABLE_ACCURACY || mTimer.getMillisUntilFinished() == 0);
  }
}
Program: 142221
Project: 142221
Buggy source:
/** 
 * Sets up the look and actions for the progress dialog while the GPS is searching.
 */
private void setupLocationDialog(){
  OnClickListener cancelButtonListener=new OnClickListener(){
    @Override public void onClick(    View v){
      mLocation=null;
      finish();
    }
  }
;
  OnClickListener okButtonListener=new OnClickListener(){
    public void onClick(    View v){
      returnLocation();
    }
  }
;
  mLocationDialog=new GeoProgressDialog(this,getString(R.string.found_location),getString(R.string.finding_location));
  mLocationDialog.setCancelable(false);
  mLocationDialog.setImage(getResources().getDrawable(R.drawable.green_check_mark));
  mLocationDialog.setMessage(getString(R.string.please_wait_long));
  mLocationDialog.setOKButton(getString(R.string.accept_location),okButtonListener);
  mLocationDialog.setCancelButton(getString(R.string.cancel_location),cancelButtonListener);
}

Fixed version (ground truth):
/** 
 * Sets up the look and actions for the progress dialog while the GPS is searching.
 */
private void setupLocationDialog(){
  OnClickListener cancelButtonListener=new OnClickListener(){
    @Override public void onClick(    View v){
      mLocation=null;
      finish();
    }
  }
;
  OnClickListener okButtonListener=new OnClickListener(){
    public void onClick(    View v){
      returnLocation();
    }
  }
;
  mLocationDialog=new GeoProgressDialog(this,StringUtils.getStringRobust(this,R.string.found_location),StringUtils.getStringRobust(this,R.string.finding_location));
  mLocationDialog.setCancelable(false);
  mLocationDialog.setImage(getResources().getDrawable(R.drawable.green_check_mark));
  mLocationDialog.setMessage(StringUtils.getStringRobust(this,R.string.please_wait_long));
  mLocationDialog.setOKButton(StringUtils.getStringRobust(this,R.string.accept_location),okButtonListener);
  mLocationDialog.setCancelButton(StringUtils.getStringRobust(this,R.string.cancel_location),cancelButtonListener);
}
Program: 142225
Project: 142225
Buggy source:
public static void addDisplayToMenu(Context context,Menu menu,int menuId,DisplayUnit display){
  Bitmap b=ViewUtil.inflateDisplayImage(context,display.getImageURI().evaluate());
  MenuItem item=menu.add(0,menuId,menuId,Localizer.clearArguments(display.getText().evaluate()).trim());
  if (b != null) {
    item.setIcon(new BitmapDrawable(context.getResources(),b));
  }
}

Fixed version (ground truth):
public static void addDisplayToMenu(Context context,Menu menu,int menuId,DisplayData display){
  MenuItem item=menu.add(0,menuId,menuId,Localizer.clearArguments(display.getName()).trim());
  if (display.getImageURI() != null) {
    Bitmap b=ViewUtil.inflateDisplayImage(context,display.getImageURI());
    if (b != null) {
      item.setIcon(new BitmapDrawable(context.getResources(),b));
    }
  }
}
Program: 142226
Project: 142226
Buggy source:
public static void addDisplayToMenu(Context context,Menu menu,int menuId,DisplayUnit display){
  Bitmap b=ViewUtil.inflateDisplayImage(context,display.getImageURI().evaluate());
  MenuItem item=menu.add(0,menuId,menuId,Localizer.clearArguments(display.getText().evaluate()).trim());
  if (b != null) {
    item.setIcon(new BitmapDrawable(context.getResources(),b));
  }
}

Fixed version (ground truth):
public static void addDisplayToMenu(Context context,Menu menu,int menuId,DisplayData display){
  MenuItem item=menu.add(0,menuId,menuId,Localizer.clearArguments(display.getName()).trim());
  if (display.getImageURI() != null) {
    Bitmap b=ViewUtil.inflateDisplayImage(context,display.getImageURI());
    if (b != null) {
      item.setIcon(new BitmapDrawable(context.getResources(),b));
    }
  }
}
Program: 142229
Project: 142229
Buggy source:
public AndroidCaseInstanceTreeElement(AbstractTreeElement instanceRoot,SqlStorage<ACase> storage,boolean reportMode){
  super(instanceRoot,storage,reportMode);
  mCaseIndexTable=new CaseIndexTable();
}

Fixed version (ground truth):
public AndroidCaseInstanceTreeElement(AbstractTreeElement instanceRoot,SqlStorage<ACase> storage,boolean reportMode,CaseIndexTable caseIndexTable){
  super(instanceRoot,storage,reportMode);
  mCaseIndexTable=caseIndexTable;
}
Program: 142230
Project: 142230
Buggy source:
@Before public void setupTests(){
  PrototypeFactory.setStaticHasher(factory);
  AndroidUtil.initializeStaticHandlers();
}

Fixed version (ground truth):
@Before public void setupTests(){
  TestUtils.initializeStaticTestStorage();
}
Program: 142231
Project: 142231
Buggy source:
@Test public void testTypeChange(){
  processResourceTransaction("String_Node_Str");
  Case c=getCaseStorage().getRecordForValue(ACase.INDEX_CASE_ID,"String_Node_Str");
  assertEquals("String_Node_Str","String_Node_Str",c.getTypeId());
  processResourceTransaction("String_Node_Str");
  Case c2=getCaseStorage().getRecordForValue(ACase.INDEX_CASE_ID,"String_Node_Str");
  assertEquals("String_Node_Str","String_Node_Str",c2.getTypeId());
}

Fixed version (ground truth):
@Test public void testTypeChange(){
  TestUtils.processResourceTransaction("String_Node_Str");
  Case c=TestUtils.getCaseStorage().getRecordForValue(ACase.INDEX_CASE_ID,"String_Node_Str");
  assertEquals("String_Node_Str","String_Node_Str",c.getTypeId());
  TestUtils.processResourceTransaction("String_Node_Str");
  Case c2=TestUtils.getCaseStorage().getRecordForValue(ACase.INDEX_CASE_ID,"String_Node_Str");
  assertEquals("String_Node_Str","String_Node_Str",c2.getTypeId());
}
Program: 142232
Project: 142232
Buggy source:
@Test public void testIndexRemoval(){
  processResourceTransaction("String_Node_Str");
  Case c=getCaseStorage().getRecordForValue(ACase.INDEX_CASE_ID,"String_Node_Str");
  assertEquals("String_Node_Str","String_Node_Str",c.getName());
  assertEquals("String_Node_Str","String_Node_Str",c.getPropertyString("String_Node_Str"));
  processResourceTransaction("String_Node_Str");
  Case c2=getCaseStorage().getRecordForValue(ACase.INDEX_CASE_ID,"String_Node_Str");
  assertEquals("String_Node_Str","String_Node_Str",c2.getPropertyString("String_Node_Str"));
  processResourceTransaction("String_Node_Str");
  Case c3=getCaseStorage().getRecordForValue(ACase.INDEX_CASE_ID,"String_Node_Str");
  assertEquals("String_Node_Str","String_Node_Str",c3.getIndices().elementAt(0).getTarget());
  processResourceTransaction("String_Node_Str");
  Case c4=getCaseStorage().getRecordForValue(ACase.INDEX_CASE_ID,"String_Node_Str");
  assertEquals("String_Node_Str",0,c4.getIndices().size());
}

Fixed version (ground truth):
@Test public void testIndexRemoval(){
  TestUtils.processResourceTransaction("String_Node_Str");
  Case c=TestUtils.getCaseStorage().getRecordForValue(ACase.INDEX_CASE_ID,"String_Node_Str");
  assertEquals("String_Node_Str","String_Node_Str",c.getName());
  assertEquals("String_Node_Str","String_Node_Str",c.getPropertyString("String_Node_Str"));
  TestUtils.processResourceTransaction("String_Node_Str");
  Case c2=TestUtils.getCaseStorage().getRecordForValue(ACase.INDEX_CASE_ID,"String_Node_Str");
  assertEquals("String_Node_Str","String_Node_Str",c2.getPropertyString("String_Node_Str"));
  TestUtils.processResourceTransaction("String_Node_Str");
  Case c3=TestUtils.getCaseStorage().getRecordForValue(ACase.INDEX_CASE_ID,"String_Node_Str");
  assertEquals("String_Node_Str","String_Node_Str",c3.getIndices().elementAt(0).getTarget());
  TestUtils.processResourceTransaction("String_Node_Str");
  Case c4=TestUtils.getCaseStorage().getRecordForValue(ACase.INDEX_CASE_ID,"String_Node_Str");
  assertEquals("String_Node_Str",0,c4.getIndices().size());
}
Program: 142234
Project: 142234
Buggy source:
public EvaluationContext getEvaluationContext(){
  return session.getEvaluationContext(getIIF());
}

Fixed version (ground truth):
/** 
 * @param commandId The id of the command to evaluate against
 * @return The evaluation context relevant for the provided command id 
 */
public EvaluationContext getEvaluationContext(String commandId){
  return session.getEvaluationContext(getIIF(),commandId);
}
Program: 142238
Project: 142238
Buggy source:
/** 
 * Begin closing down the session by notifying any pending forms that they need to saved and waiting for that to occur before closing down key pool and user database.
 */
public void startLogout(){
  this.sendBroadcast(new Intent(KEY_SESSION_ENDING));
  if (formSaver != null) {
    formSaver.formSaveCallback();
  }
}

Fixed version (ground truth):
/** 
 * Begin closing down the session by notifying any pending form that it needs to save. Logout is then completed in finishLogout after waiting for the form save to finish/timeout, after which key pool and user database are closed down.
 */
public void startLogout(){
  if (formSaver != null) {
    formSaver.formSaveCallback();
  }
}
Program: 142239
Project: 142239
Buggy source:
/** 
 * Conclude closing down the session by closing down key pool and user database.
 */
public void finishLogout(){
synchronized (lock) {
    key=null;
    String msg="String_Node_Str";
    Intent i=new Intent("String_Node_Str");
    this.sendBroadcast(i);
    Logger.log(AndroidLogger.TYPE_MAINTENANCE,msg);
    if (user != null) {
      if (user.getUsername() != null) {
        msg="String_Node_Str" + user.getUsername();
      }
      user=null;
    }
    if (userDatabase != null) {
      if (userDatabase.isOpen()) {
        userDatabase.close();
      }
      userDatabase=null;
    }
    if (maintenanceTimer != null) {
      maintenanceTimer.cancel();
    }
    logoutStartedAt=-1;
    pool.expire();
    this.stopForeground(true);
  }
}

Fixed version (ground truth):
/** 
 * Conclude closing down the session by closing down key pool and user database.
 */
public void finishLogout(){
synchronized (lock) {
    if (!isLoggedIn()) {
      return;
    }
    key=null;
    String msg="String_Node_Str";
    Intent i=new Intent("String_Node_Str");
    this.sendBroadcast(i);
    Logger.log(AndroidLogger.TYPE_MAINTENANCE,msg);
    if (user != null) {
      if (user.getUsername() != null) {
        msg="String_Node_Str" + user.getUsername();
      }
      user=null;
    }
    if (userDatabase != null) {
      if (userDatabase.isOpen()) {
        userDatabase.close();
      }
      userDatabase=null;
    }
    if (maintenanceTimer != null) {
      maintenanceTimer.cancel();
    }
    logoutStartedAt=-1;
    pool.expire();
    this.stopForeground(true);
  }
}
Program: 142240
Project: 142240
Buggy source:
private void maintenance(){
  long time=new Date().getTime();
  if (logoutStartedAt != -1 && time > (logoutStartedAt + LOGOUT_TIMEOUT)) {
    finishLogout();
  }
  if (isLoggedIn() && logoutStartedAt == -1 && (time > sessionExpireDate.getTime() || (sessionExpireDate.getTime() - time > SESSION_LENGTH))) {
    logoutStartedAt=new Date().getTime();
    startLogout();
    showLoggedOutNotification();
  }
}

Fixed version (ground truth):
private void maintenance(){
  long time=new Date().getTime();
  if (logoutStartedAt != -1 && time > (logoutStartedAt + LOGOUT_TIMEOUT)) {
    finishLogout();
    Intent loginIntent=new Intent(getApplicationContext(),CommCareHomeActivity.class);
    loginIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
    loginIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(loginIntent);
  }
  if (isLoggedIn() && logoutStartedAt == -1 && (time > sessionExpireDate.getTime() || (sessionExpireDate.getTime() - time > SESSION_LENGTH))) {
    logoutStartedAt=new Date().getTime();
    CommCareApplication._().logout();
    showLoggedOutNotification();
  }
}
Program: 142241
Project: 142241
Buggy source:
public void formSaveCallback(){
  savingFormOnKeySessionExpiration=true;
  saveDataToDisk(EXIT,false,null,true);
}

Fixed version (ground truth):
public void formSaveCallback(){
  if (!hasSaved) {
    savingFormOnKeySessionExpiration=true;
    saveDataToDisk(EXIT,false,null,true);
  }
}
Program: 142242
Project: 142242
Buggy source:
@Override protected void onPause(){
  super.onPause();
  dismissDialogs();
  if (mCurrentView != null && currentPromptIsQuestion()) {
    saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS);
  }
  if (mNoGPSReceiver != null) {
    unregisterReceiver(mNoGPSReceiver);
  }
  if (mKeySessionCloseReceiver != null) {
    unregisterReceiver(mKeySessionCloseReceiver);
  }
}

Fixed version (ground truth):
@Override protected void onPause(){
  super.onPause();
  dismissDialogs();
  if (mCurrentView != null && currentPromptIsQuestion()) {
    saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS);
  }
  if (mNoGPSReceiver != null) {
    unregisterReceiver(mNoGPSReceiver);
  }
}
Program: 142243
Project: 142243
Buggy source:
/** 
 * Setup BroadcastReceivers for: - going to login screen when key session closes - asking user if they want to enable gps
 */
private void registerFormEntryReceivers(){
  mKeySessionCloseReceiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      Intent i=new Intent(getApplicationContext(),LoginActivity.class);
      i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
      startActivity(i);
    }
  }
;
  registerReceiver(mKeySessionCloseReceiver,new IntentFilter(CommCareSessionService.KEY_SESSION_ENDING));
  mNoGPSReceiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      context.removeStickyBroadcast(intent);
      LocationManager manager=(LocationManager)context.getSystemService(Context.LOCATION_SERVICE);
      Set<String> providers=GeoUtils.evaluateProviders(manager);
      if (providers.isEmpty()) {
        DialogInterface.OnClickListener onChangeListener=new DialogInterface.OnClickListener(){
          public void onClick(          DialogInterface dialog,          int i){
            if (i == DialogInterface.BUTTON_POSITIVE) {
              Intent intent=new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
              startActivity(intent);
            }
          }
        }
;
        GeoUtils.showNoGpsDialog(FormEntryActivity.this,onChangeListener);
      }
    }
  }
;
  registerReceiver(mNoGPSReceiver,new IntentFilter(GeoUtils.ACTION_CHECK_GPS_ENABLED));
}

Fixed version (ground truth):
/** 
 * Setup BroadcastReceiver for asking user if they want to enable gps
 */
private void registerFormEntryReceivers(){
  mNoGPSReceiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      context.removeStickyBroadcast(intent);
      LocationManager manager=(LocationManager)context.getSystemService(Context.LOCATION_SERVICE);
      Set<String> providers=GeoUtils.evaluateProviders(manager);
      if (providers.isEmpty()) {
        DialogInterface.OnClickListener onChangeListener=new DialogInterface.OnClickListener(){
          public void onClick(          DialogInterface dialog,          int i){
            if (i == DialogInterface.BUTTON_POSITIVE) {
              Intent intent=new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
              startActivity(intent);
            }
          }
        }
;
        GeoUtils.showNoGpsDialog(FormEntryActivity.this,onChangeListener);
      }
    }
  }
;
  registerReceiver(mNoGPSReceiver,new IntentFilter(GeoUtils.ACTION_CHECK_GPS_ENABLED));
}
Program: 142244
Project: 142244
Buggy source:
/** 
 * {@inheritDoc}Display save status notification and exit or continue on in the form. If form entry is being saved because key session is expiring then broadcast the successful save.
 * @see org.odk.collect.android.listeners.FormSavedListener#savingComplete(int)
 */
@Override public void savingComplete(int saveStatus,boolean headless){
  if (!headless) {
    dismissDialog(SAVING_DIALOG);
  }
  if (savingFormOnKeySessionExpiration) {
    CommCareApplication._().getSession().finishLogout();
    savingFormOnKeySessionExpiration=false;
    return;
  }
 else {
switch (saveStatus) {
case SaveToDiskTask.SAVED:
      Toast.makeText(this,StringUtils.getStringSpannableRobust(this,R.string.data_saved_ok),Toast.LENGTH_SHORT).show();
    hasSaved=true;
  break;
case SaveToDiskTask.SAVED_AND_EXIT:
Toast.makeText(this,StringUtils.getStringSpannableRobust(this,R.string.data_saved_ok),Toast.LENGTH_SHORT).show();
hasSaved=true;
finishReturnInstance();
break;
case SaveToDiskTask.SAVE_ERROR:
Toast.makeText(this,StringUtils.getStringSpannableRobust(this,R.string.data_saved_error),Toast.LENGTH_LONG).show();
break;
case FormEntryController.ANSWER_CONSTRAINT_VIOLATED:
case FormEntryController.ANSWER_REQUIRED_BUT_EMPTY:
refreshCurrentView();
next();
break;
}
}
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}Display save status notification and exit or continue on in the form. If form entry is being saved because key session is expiring then broadcast the successful save.
 * @see org.odk.collect.android.listeners.FormSavedListener#savingComplete(int)
 */
@Override public void savingComplete(int saveStatus,boolean headless){
  if (!headless) {
    dismissDialog(SAVING_DIALOG);
  }
  if (savingFormOnKeySessionExpiration) {
    try {
      CommCareApplication._().getSession().finishLogout();
    }
 catch (    SessionUnavailableException sue) {
    }
    savingFormOnKeySessionExpiration=false;
    if (saveStatus == SaveToDiskTask.SAVED || saveStatus == SaveToDiskTask.SAVED_AND_EXIT) {
      hasSaved=true;
    }
    Intent loginIntent=new Intent(getApplicationContext(),CommCareHomeActivity.class);
    loginIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
    loginIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(loginIntent);
    return;
  }
 else {
switch (saveStatus) {
case SaveToDiskTask.SAVED:
      Toast.makeText(this,StringUtils.getStringSpannableRobust(this,R.string.data_saved_ok),Toast.LENGTH_SHORT).show();
    hasSaved=true;
  break;
case SaveToDiskTask.SAVED_AND_EXIT:
Toast.makeText(this,StringUtils.getStringSpannableRobust(this,R.string.data_saved_ok),Toast.LENGTH_SHORT).show();
hasSaved=true;
finishReturnInstance();
break;
case SaveToDiskTask.SAVE_ERROR:
Toast.makeText(this,StringUtils.getStringSpannableRobust(this,R.string.data_saved_error),Toast.LENGTH_LONG).show();
break;
case FormEntryController.ANSWER_CONSTRAINT_VIOLATED:
case FormEntryController.ANSWER_REQUIRED_BUT_EMPTY:
refreshCurrentView();
next();
break;
}
}
}
Program: 142245
Project: 142245
Buggy source:
public void setParams(FormRecord record,String dataTitle,Long timestamp) throws SessionUnavailableException {
  if (names.containsKey(record.getFormNamespace())) {
    Text name=names.get(record.getFormNamespace());
    mPrimaryTextView.setText(MarkupUtil.localizeStyleSpannable(IncompleteFormRecordView.this.getContext(),name.evaluate()));
  }
 else {
    formExists=false;
    mPrimaryTextView.setText(MarkupUtil.localizeStyleSpannable(IncompleteFormRecordView.this.getContext(),"String_Node_Str"));
  }
  if (dataTitle != null) {
    mLowerTextView.setText(dataTitle);
  }
  if (timestamp != 0) {
    mRightTextView.setText(DateUtils.formatSameDayTime(timestamp,start.getTime(),DateFormat.DEFAULT,DateFormat.DEFAULT));
  }
 else {
    mRightTextView.setText("String_Node_Str");
  }
  if (record.getStatus() == FormRecord.STATUS_UNSENT) {
    mUpperRight.setText(MarkupUtil.localizeStyleSpannable(IncompleteFormRecordView.this.getContext(),"String_Node_Str"));
    mUpperRight.setTextAppearance(getContext(),R.style.WarningTextStyle);
    mUpperRight.setCompoundDrawablesWithIntrinsicBounds(null,null,rightHandSync,null);
  }
 else {
    mUpperRight.setText("String_Node_Str");
    mUpperRight.setCompoundDrawables(null,null,null,null);
  }
}

Fixed version (ground truth):
public void setParams(FormRecord record,String dataTitle,Long timestamp) throws SessionUnavailableException {
  if (names.containsKey(record.getFormNamespace())) {
    Text name=names.get(record.getFormNamespace());
    mPrimaryTextView.setText(MarkupUtil.styleSpannable(IncompleteFormRecordView.this.getContext(),name.evaluate()));
  }
 else {
    formExists=false;
    mPrimaryTextView.setText(MarkupUtil.localizeStyleSpannable(IncompleteFormRecordView.this.getContext(),"String_Node_Str"));
  }
  if (dataTitle != null) {
    mLowerTextView.setText(dataTitle);
  }
  if (timestamp != 0) {
    mRightTextView.setText(DateUtils.formatSameDayTime(timestamp,start.getTime(),DateFormat.DEFAULT,DateFormat.DEFAULT));
  }
 else {
    mRightTextView.setText("String_Node_Str");
  }
  if (record.getStatus() == FormRecord.STATUS_UNSENT) {
    mUpperRight.setText(MarkupUtil.localizeStyleSpannable(IncompleteFormRecordView.this.getContext(),"String_Node_Str"));
    mUpperRight.setTextAppearance(getContext(),R.style.WarningTextStyle);
    mUpperRight.setCompoundDrawablesWithIntrinsicBounds(null,null,rightHandSync,null);
  }
 else {
    mUpperRight.setText("String_Node_Str");
    mUpperRight.setCompoundDrawables(null,null,null,null);
  }
}
Program: 142247
Project: 142247
Buggy source:
@Override protected void deliverResult(ConnectionDiagnosticActivity receiver,ConnectionDiagnosticTask.Test failedTest){
  if (failedTest == ConnectionDiagnosticTask.Test.isOnline || failedTest == ConnectionDiagnosticTask.Test.googlePing) {
    String displayMessage=failedTest == ConnectionDiagnosticTask.Test.isOnline ? Localization.get("String_Node_Str") : Localization.get("String_Node_Str");
    receiver.txtInteractiveMessages.setText(localize(displayMessage));
    receiver.txtInteractiveMessages.setVisibility(View.VISIBLE);
    receiver.settingsButton.setVisibility(View.VISIBLE);
  }
 else   if (failedTest == ConnectionDiagnosticTask.Test.commCarePing) {
    receiver.txtInteractiveMessages.setText(Localization.get("String_Node_Str"));
    receiver.txtInteractiveMessages.setVisibility(View.VISIBLE);
    receiver.reportButton.setVisibility(View.VISIBLE);
  }
 else   if (failedTest == null) {
    receiver.txtInteractiveMessages.setText(Localization.get("String_Node_Str"));
    receiver.txtInteractiveMessages.setVisibility(View.VISIBLE);
    receiver.settingsButton.setVisibility(View.INVISIBLE);
    receiver.reportButton.setVisibility(View.INVISIBLE);
  }
  return;
}

Fixed version (ground truth):
@Override protected void deliverResult(ConnectionDiagnosticActivity receiver,ConnectionDiagnosticTask.Test failedTest){
  if (failedTest == ConnectionDiagnosticTask.Test.isOnline || failedTest == ConnectionDiagnosticTask.Test.googlePing) {
    String displayMessage=failedTest == ConnectionDiagnosticTask.Test.isOnline ? Localization.get("String_Node_Str") : Localization.get("String_Node_Str");
    receiver.txtInteractiveMessages.setText(displayMessage);
    receiver.txtInteractiveMessages.setVisibility(View.VISIBLE);
    receiver.settingsButton.setVisibility(View.VISIBLE);
  }
 else   if (failedTest == ConnectionDiagnosticTask.Test.commCarePing) {
    receiver.txtInteractiveMessages.setText(Localization.get("String_Node_Str"));
    receiver.txtInteractiveMessages.setVisibility(View.VISIBLE);
    receiver.reportButton.setVisibility(View.VISIBLE);
  }
 else   if (failedTest == null) {
    receiver.txtInteractiveMessages.setText(Localization.get("String_Node_Str"));
    receiver.txtInteractiveMessages.setVisibility(View.VISIBLE);
    receiver.settingsButton.setVisibility(View.INVISIBLE);
    receiver.reportButton.setVisibility(View.INVISIBLE);
  }
  return;
}
Program: 142248
Project: 142248
Buggy source:
public void setParams(FormRecord record,String dataTitle,Long timestamp) throws SessionUnavailableException {
  if (names.containsKey(record.getFormNamespace())) {
    Text name=names.get(record.getFormNamespace());
    mPrimaryTextView.setText(MarkupUtil.localizeStyleSpannable(IncompleteFormRecordView.this.getContext(),name.evaluate()));
  }
 else {
    formExists=false;
    mPrimaryTextView.setText(MarkupUtil.localizeStyleSpannable(IncompleteFormRecordView.this.getContext(),"String_Node_Str"));
  }
  if (dataTitle != null) {
    mLowerTextView.setText(dataTitle);
  }
  if (timestamp != 0) {
    mRightTextView.setText(DateUtils.formatSameDayTime(timestamp,start.getTime(),DateFormat.DEFAULT,DateFormat.DEFAULT));
  }
 else {
    mRightTextView.setText("String_Node_Str");
  }
  if (record.getStatus() == FormRecord.STATUS_UNSENT) {
    mUpperRight.setText(MarkupUtil.localizeStyleSpannable(IncompleteFormRecordView.this.getContext(),"String_Node_Str"));
    mUpperRight.setTextAppearance(getContext(),R.style.WarningTextStyle);
    mUpperRight.setCompoundDrawablesWithIntrinsicBounds(null,null,rightHandSync,null);
  }
 else {
    mUpperRight.setText("String_Node_Str");
    mUpperRight.setCompoundDrawables(null,null,null,null);
  }
}

Fixed version (ground truth):
public void setParams(FormRecord record,String dataTitle,Long timestamp) throws SessionUnavailableException {
  if (names.containsKey(record.getFormNamespace())) {
    Text name=names.get(record.getFormNamespace());
    mPrimaryTextView.setText(MarkupUtil.styleSpannable(IncompleteFormRecordView.this.getContext(),name.evaluate()));
  }
 else {
    formExists=false;
    mPrimaryTextView.setText(MarkupUtil.localizeStyleSpannable(IncompleteFormRecordView.this.getContext(),"String_Node_Str"));
  }
  if (dataTitle != null) {
    mLowerTextView.setText(dataTitle);
  }
  if (timestamp != 0) {
    mRightTextView.setText(DateUtils.formatSameDayTime(timestamp,start.getTime(),DateFormat.DEFAULT,DateFormat.DEFAULT));
  }
 else {
    mRightTextView.setText("String_Node_Str");
  }
  if (record.getStatus() == FormRecord.STATUS_UNSENT) {
    mUpperRight.setText(MarkupUtil.localizeStyleSpannable(IncompleteFormRecordView.this.getContext(),"String_Node_Str"));
    mUpperRight.setTextAppearance(getContext(),R.style.WarningTextStyle);
    mUpperRight.setCompoundDrawablesWithIntrinsicBounds(null,null,rightHandSync,null);
  }
 else {
    mUpperRight.setText("String_Node_Str");
    mUpperRight.setCompoundDrawables(null,null,null,null);
  }
}
Program: 142250
Project: 142250
Buggy source:
@Override protected void deliverResult(ConnectionDiagnosticActivity receiver,ConnectionDiagnosticTask.Test failedTest){
  if (failedTest == ConnectionDiagnosticTask.Test.isOnline || failedTest == ConnectionDiagnosticTask.Test.googlePing) {
    String displayMessage=failedTest == ConnectionDiagnosticTask.Test.isOnline ? Localization.get("String_Node_Str") : Localization.get("String_Node_Str");
    receiver.txtInteractiveMessages.setText(localize(displayMessage));
    receiver.txtInteractiveMessages.setVisibility(View.VISIBLE);
    receiver.settingsButton.setVisibility(View.VISIBLE);
  }
 else   if (failedTest == ConnectionDiagnosticTask.Test.commCarePing) {
    receiver.txtInteractiveMessages.setText(Localization.get("String_Node_Str"));
    receiver.txtInteractiveMessages.setVisibility(View.VISIBLE);
    receiver.reportButton.setVisibility(View.VISIBLE);
  }
 else   if (failedTest == null) {
    receiver.txtInteractiveMessages.setText(Localization.get("String_Node_Str"));
    receiver.txtInteractiveMessages.setVisibility(View.VISIBLE);
    receiver.settingsButton.setVisibility(View.INVISIBLE);
    receiver.reportButton.setVisibility(View.INVISIBLE);
  }
  return;
}

Fixed version (ground truth):
@Override protected void deliverResult(ConnectionDiagnosticActivity receiver,ConnectionDiagnosticTask.Test failedTest){
  if (failedTest == ConnectionDiagnosticTask.Test.isOnline || failedTest == ConnectionDiagnosticTask.Test.googlePing) {
    String displayMessage=failedTest == ConnectionDiagnosticTask.Test.isOnline ? Localization.get("String_Node_Str") : Localization.get("String_Node_Str");
    receiver.txtInteractiveMessages.setText(displayMessage);
    receiver.txtInteractiveMessages.setVisibility(View.VISIBLE);
    receiver.settingsButton.setVisibility(View.VISIBLE);
  }
 else   if (failedTest == ConnectionDiagnosticTask.Test.commCarePing) {
    receiver.txtInteractiveMessages.setText(Localization.get("String_Node_Str"));
    receiver.txtInteractiveMessages.setVisibility(View.VISIBLE);
    receiver.reportButton.setVisibility(View.VISIBLE);
  }
 else   if (failedTest == null) {
    receiver.txtInteractiveMessages.setText(Localization.get("String_Node_Str"));
    receiver.txtInteractiveMessages.setVisibility(View.VISIBLE);
    receiver.settingsButton.setVisibility(View.INVISIBLE);
    receiver.reportButton.setVisibility(View.INVISIBLE);
  }
  return;
}
Program: 142251
Project: 142251
Buggy source:
@Override public void run(){
  current=matchList;
  if (actionEnabled) {
    actionPosition=current.size();
  }
  currentSearchTerms=searchTerms;
  update();
}

Fixed version (ground truth):
@Override public void run(){
  setCurrent(matchList);
  currentSearchTerms=searchTerms;
  update();
}
Program: 142253
Project: 142253
Buggy source:
public EntityListAdapter(Activity activity,Detail detail,List<TreeReference> references,List<Entity<TreeReference>> full,int[] sort,TextToSpeech tts,AudioController controller,NodeEntityFactory factory) throws SessionUnavailableException {
  this.detail=detail;
  this.full=full;
  current=new ArrayList<Entity<TreeReference>>();
  this.references=references;
  this.context=activity;
  this.observers=new ArrayList<DataSetObserver>();
  mNodeFactory=factory;
  mAsyncMode=(factory instanceof AsyncNodeEntityFactory);
  if (!mAsyncMode) {
    if (sort.length != 0) {
      sort(sort);
    }
    filterValues("String_Node_Str");
  }
 else {
    current=new ArrayList<Entity<TreeReference>>(full);
    actionPosition=current.size();
  }
  this.tts=tts;
  this.controller=controller;
  if (android.os.Build.VERSION.SDK_INT >= 14) {
    mImageLoader=new CachingAsyncImageLoader(context,SCALE_FACTOR);
  }
 else {
    mImageLoader=null;
  }
  if (detail.getCustomAction() != null) {
  }
  usesGridView=detail.usesGridView();
  this.mFuzzySearchEnabled=CommCarePreferences.isFuzzySearchEnabled();
  actionEnabled=detail.getCustomAction() != null;
}

Fixed version (ground truth):
public EntityListAdapter(Activity activity,Detail detail,List<TreeReference> references,List<Entity<TreeReference>> full,int[] sort,TextToSpeech tts,AudioController controller,NodeEntityFactory factory) throws SessionUnavailableException {
  this.detail=detail;
  actionEnabled=detail.getCustomAction() != null;
  this.full=full;
  setCurrent(new ArrayList<Entity<TreeReference>>());
  this.references=references;
  this.context=activity;
  this.observers=new ArrayList<DataSetObserver>();
  mNodeFactory=factory;
  mAsyncMode=(factory instanceof AsyncNodeEntityFactory);
  if (!mAsyncMode) {
    if (sort.length != 0) {
      sort(sort);
    }
    filterValues("String_Node_Str");
  }
 else {
    setCurrent(new ArrayList<Entity<TreeReference>>(full));
  }
  this.tts=tts;
  this.controller=controller;
  if (android.os.Build.VERSION.SDK_INT >= 14) {
    mImageLoader=new CachingAsyncImageLoader(context,SCALE_FACTOR);
  }
 else {
    mImageLoader=null;
  }
  if (detail.getCustomAction() != null) {
  }
  usesGridView=detail.usesGridView();
  this.mFuzzySearchEnabled=CommCarePreferences.isFuzzySearchEnabled();
}
Program: 142254
Project: 142254
Buggy source:
public StringWidget(Context context,FormEntryPrompt prompt,boolean secret){
  super(context,prompt);
  mAnswer=new EditText(context);
  mAnswer.setTextSize(TypedValue.COMPLEX_UNIT_DIP,mAnswerFontsize);
  mAnswer.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
  mAnswer.setOnClickListener(this);
  TableLayout.LayoutParams params=new TableLayout.LayoutParams();
  params.setMargins(7,5,7,5);
  mAnswer.setLayoutParams(params);
  mAnswer.addTextChangedListener(this);
  try {
    addAnswerFilter(new InputFilter.LengthFilter(guessMaxStringLength(prompt)));
  }
 catch (  UnpivotableExpressionException e) {
  }
  this.secret=secret;
  if (!secret) {
    mAnswer.setKeyListener(new TextKeyListener(Capitalize.SENTENCES,false));
  }
  setTextInputType(mAnswer);
  mAnswer.setHorizontallyScrolling(false);
  if (!secret) {
    mAnswer.setSingleLine(false);
  }
  if (prompt != null) {
    mReadOnly=prompt.isReadOnly();
    String s=prompt.getAnswerText();
    if (s != null) {
      mAnswer.setText(s);
    }
    if (mReadOnly) {
      if (s == null) {
        mAnswer.setText("String_Node_Str");
      }
      mAnswer.setBackgroundDrawable(null);
      mAnswer.setFocusable(false);
      mAnswer.setClickable(false);
    }
  }
  addView(mAnswer);
}

Fixed version (ground truth):
public StringWidget(Context context,FormEntryPrompt prompt,boolean secret){
  super(context,prompt);
  mAnswer=new EditText(context);
  mAnswer.setTextSize(TypedValue.COMPLEX_UNIT_DIP,mAnswerFontsize);
  mAnswer.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
  mAnswer.setOnClickListener(this);
  TableLayout.LayoutParams params=new TableLayout.LayoutParams();
  params.setMargins(7,5,7,5);
  mAnswer.setLayoutParams(params);
  mAnswer.addTextChangedListener(this);
  try {
    addAnswerFilter(new InputFilter.LengthFilter(guessMaxStringLength(prompt)));
  }
 catch (  UnpivotableExpressionException e) {
  }
  this.secret=secret;
  if (!secret) {
    mAnswer.setKeyListener(new TextKeyListener(Capitalize.SENTENCES,false));
  }
  setTextInputType(mAnswer);
  mAnswer.setHorizontallyScrolling(false);
  if (!secret) {
    mAnswer.setSingleLine(false);
  }
  if (prompt != null) {
    mReadOnly=prompt.isReadOnly();
    IAnswerData value=prompt.getAnswerValue();
    if (value != null) {
      mAnswer.setText(value.getDisplayText());
    }
    if (mReadOnly) {
      if (value == null) {
        mAnswer.setText("String_Node_Str");
      }
      mAnswer.setBackgroundDrawable(null);
      mAnswer.setFocusable(false);
      mAnswer.setClickable(false);
    }
  }
  addView(mAnswer);
}
Program: 142255
Project: 142255
Buggy source:
@Override protected Vector<Integer> union(Vector<Integer> selectedCases,Vector<Integer> cases){
  HashSet<Integer> selected=new HashSet<Integer>(selectedCases);
  selected.addAll(selectedCases);
  HashSet<Integer> other=new HashSet<Integer>();
  other.addAll(cases);
  selected.retainAll(other);
  selectedCases.clear();
  selectedCases.addAll(selected);
  return selectedCases;
}

Fixed version (ground truth):
@Override protected Vector<Integer> union(Vector<Integer> selectedCases,Vector<Integer> cases){
  return DataUtil.union(selectedCases,cases);
}
Program: 142256
Project: 142256
Buggy source:
@Override public void onCreate(){
  super.onCreate();
  Collect.setStaticApplicationContext(this);
  AndroidClassHasher.registerAndroidClassHashStrategy();
  CommCareApplication.app=this;
  PreInitLogger pil=new PreInitLogger();
  Logger.registerLogger(pil);
  System.setProperty("String_Node_Str","String_Node_Str");
  Thread.setDefaultUncaughtExceptionHandler(new CommCareExceptionHandler(Thread.getDefaultUncaughtExceptionHandler()));
  PropertyManager.setPropertyManager(new ODKPropertyManager());
  SQLiteDatabase.loadLibs(this);
  setRoots();
  prepareTemporaryStorage();
  dbState=initGlobalDb();
  try {
    LegacyInstallUtils.checkForLegacyInstall(this,this.getGlobalStorage(ApplicationRecord.class));
  }
 catch (  StorageFullException sfe) {
    throw new RuntimeException(sfe);
  }
 finally {
    Logger.registerLogger(new AndroidLogger(this.getGlobalStorage(AndroidLogEntry.STORAGE_KEY,AndroidLogEntry.class)));
    pil.dumpToNewLogger();
  }
  intializeDefaultLocalizerData();
  resourceState=STATE_UNINSTALLED;
  resourceState=initializeAppResources();
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
  Collect.setStaticApplicationContext(this);
  AndroidClassHasher.registerAndroidClassHashStrategy();
  AndroidUtil.initializeStaticHandlers();
  CommCareApplication.app=this;
  PreInitLogger pil=new PreInitLogger();
  Logger.registerLogger(pil);
  System.setProperty("String_Node_Str","String_Node_Str");
  Thread.setDefaultUncaughtExceptionHandler(new CommCareExceptionHandler(Thread.getDefaultUncaughtExceptionHandler()));
  PropertyManager.setPropertyManager(new ODKPropertyManager());
  SQLiteDatabase.loadLibs(this);
  setRoots();
  prepareTemporaryStorage();
  dbState=initGlobalDb();
  try {
    LegacyInstallUtils.checkForLegacyInstall(this,this.getGlobalStorage(ApplicationRecord.class));
  }
 catch (  StorageFullException sfe) {
    throw new RuntimeException(sfe);
  }
 finally {
    Logger.registerLogger(new AndroidLogger(this.getGlobalStorage(AndroidLogEntry.STORAGE_KEY,AndroidLogEntry.class)));
    pil.dumpToNewLogger();
  }
  intializeDefaultLocalizerData();
  resourceState=STATE_UNINSTALLED;
  resourceState=initializeAppResources();
}
Program: 142257
Project: 142257
Buggy source:
@Override protected Vector<Integer> union(Vector<Integer> selectedCases,Vector<Integer> cases){
  HashSet<Integer> selected=new HashSet<Integer>(selectedCases);
  selected.addAll(selectedCases);
  HashSet<Integer> other=new HashSet<Integer>();
  other.addAll(cases);
  selected.retainAll(other);
  selectedCases.clear();
  selectedCases.addAll(selected);
  return selectedCases;
}

Fixed version (ground truth):
@Override protected Vector<Integer> union(Vector<Integer> selectedCases,Vector<Integer> cases){
  return DataUtil.union(selectedCases,cases);
}
Program: 142258
Project: 142258
Buggy source:
@Override public void onCreate(){
  super.onCreate();
  Collect.setStaticApplicationContext(this);
  AndroidClassHasher.registerAndroidClassHashStrategy();
  CommCareApplication.app=this;
  PreInitLogger pil=new PreInitLogger();
  Logger.registerLogger(pil);
  System.setProperty("String_Node_Str","String_Node_Str");
  Thread.setDefaultUncaughtExceptionHandler(new CommCareExceptionHandler(Thread.getDefaultUncaughtExceptionHandler()));
  PropertyManager.setPropertyManager(new ODKPropertyManager());
  SQLiteDatabase.loadLibs(this);
  setRoots();
  prepareTemporaryStorage();
  dbState=initGlobalDb();
  try {
    LegacyInstallUtils.checkForLegacyInstall(this,this.getGlobalStorage(ApplicationRecord.class));
  }
 catch (  StorageFullException sfe) {
    throw new RuntimeException(sfe);
  }
 finally {
    Logger.registerLogger(new AndroidLogger(this.getGlobalStorage(AndroidLogEntry.STORAGE_KEY,AndroidLogEntry.class)));
    pil.dumpToNewLogger();
  }
  intializeDefaultLocalizerData();
  resourceState=STATE_UNINSTALLED;
  resourceState=initializeAppResources();
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
  Collect.setStaticApplicationContext(this);
  AndroidClassHasher.registerAndroidClassHashStrategy();
  AndroidUtil.initializeStaticHandlers();
  CommCareApplication.app=this;
  PreInitLogger pil=new PreInitLogger();
  Logger.registerLogger(pil);
  System.setProperty("String_Node_Str","String_Node_Str");
  Thread.setDefaultUncaughtExceptionHandler(new CommCareExceptionHandler(Thread.getDefaultUncaughtExceptionHandler()));
  PropertyManager.setPropertyManager(new ODKPropertyManager());
  SQLiteDatabase.loadLibs(this);
  setRoots();
  prepareTemporaryStorage();
  dbState=initGlobalDb();
  try {
    LegacyInstallUtils.checkForLegacyInstall(this,this.getGlobalStorage(ApplicationRecord.class));
  }
 catch (  StorageFullException sfe) {
    throw new RuntimeException(sfe);
  }
 finally {
    Logger.registerLogger(new AndroidLogger(this.getGlobalStorage(AndroidLogEntry.STORAGE_KEY,AndroidLogEntry.class)));
    pil.dumpToNewLogger();
  }
  intializeDefaultLocalizerData();
  resourceState=STATE_UNINSTALLED;
  resourceState=initializeAppResources();
}